Skip to content

Instantly share code, notes, and snippets.



sudo nano /etc/haproxy/haproxy.cfg // edit configuration file
haproxy -f /etc/haproxy/haproxyconf.txt -c // check configuration
haproxy -f /etc/haproxy/haproxy.cfg // run

# Recursively iterate through folder
FOLDER = ~/Desktop/Folder
for file in $(find $FOLDER -name '*.mp4'); do
echo $file # will print the full path
echo ${file##*/} # will print the filename
echo dirname $file
View Instagram

Instagram API

Authorise to obtain authorisation code[client_id]&redirect_uri=[redirect_uri]&response_type=code&scope=[basic+likes+relationships]

Obtain access token via cURL

curl -F 'client_id=[client_id]' -F 'client_secret=[client_secret]' -F 'grant_type=authorization_code' -F 'redirect_uri=[redirect_uri]' -F 'code=[authorisation_code]'

View flatten.js
function flatten(arr) {
return arr.reduce( (flat, toFlatten) => {
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
}, []);
console.log( flatten([[1,2,[3]],4]) );
View supervisor.conf
; supervisor config file
file=/tmp/supervisor.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
You can’t perform that action at this time.