Skip to content

Instantly share code, notes, and snippets.

@phamhieu
phamhieu / How to inspect disappearing element in a browser?
Created February 16, 2021 02:23
How to inspect disappearing element in a browser?
1. Open console
2. Type in setTimeout(()=>{debugger;},5000);
3. Press Enter
Now you have 5 seconds to make your element appears. Once it appeared, wait until the debugger hits. As long as you don't resume, you can play with your element and it won't disappear.
Useful tip to avoid repeating those steps above every time:
add this as a bookmarklet:
1. Bookmark any page
@phamhieu
phamhieu / docker-cleanup-resources.md
Created December 11, 2020 02:12 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@phamhieu
phamhieu / supabase_v0.35.0.js
Created August 14, 2020 01:18
Supabase standalone js client
var Supabase=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=8)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.objectToQuery
@phamhieu
phamhieu / pm2_tips.txt
Created December 16, 2018 13:42
PM2 (Production Runtime and Process Manager) for Node.js
--silent option can suppress error, so it can be use to force execute some commands, such like:
pm2 stop --silent some-name
pm2 delete --silent some-name
@phamhieu
phamhieu / GPG and git on macOS.md
Created October 25, 2018 02:39 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@phamhieu
phamhieu / gist:d7b6aad785a6e49fa42da32f56ea2099
Created September 4, 2018 05:59
Prolific USB-to-Serial Fix
http://www.totalcardiagnostics.com/support/Knowledgebase/Article/View/92/20/prolific-usb-to-serial-fix-official-solution-to-code-10-error
Download and save the "PL2303_64bit_ Installer.exe" by using "http://www.totalcardiagnostics.com/files/PL2303_64bit_Installer.exe".
Unplug all USB-To-Serial adapters from your computer - and double-click on "PL2303_64bit_Installer.exe"
When it prompts you, plug in one (1) of your USB-To-Serial adapters and click "Continue".
Reboot your computer. That's it!
The "Driver Version" must say "3.3.2.102" dated 09/24/08.
The other solution is to reassign the port number. You can do this via Device Manager.
@phamhieu
phamhieu / gist:951be143d6b17152f91ce8e5a3720352
Created August 31, 2018 02:58
TeamViewer on Ubuntu Troubleshooting
1. Switch back to Xorg (the X window system) under Ubuntu If you have problem at login
* Open file `sudo gedit /etc/gdm3/custom.conf`
* Uncomment this line in custom.conf file `WaylandEnable=false`
* Reboot
1. Teamviewer GUI not starting anymore
* sudo teamviewer daemon restart
* sudo teamviewer daemon disable
* sudo teamviewer daemon enable
* systemctl enable teamviewerd.service
@phamhieu
phamhieu / build.sh
Last active August 29, 2015 14:23 — forked from NicolasT/build.sh
#!/bin/bash -ue
# Dependencies (list might be incomplete):
# src/libevent-2.0.21-stable.tar.gz
# src/libsearpc (I used git f022c6509cff2eb604024c003eb60bcda975c0b1)
# src/ccnet (with Nicolas' patches, I used 3495a78466add16cfa9eddfb35a312bb9ce55264)
# src/seafile (with Nicolas' patches, I used 59eb918655dfa5f1328ec72be00681c6192f523d)
#
# Toolchain:
# vala (vala-0.18.1-1.fc18.x86_64)