Skip to content

Instantly share code, notes, and snippets.

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
View supervisor-non-root.conf
; supervisor config file
;file=/var/run/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
[inet_http_server] ; inet (TCP) server disabled by default
port= ; (ip_address:port specifier, *:port for all iface)
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 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]'

# 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


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



sudo service nginx restart // restart service

Configuration file: /etc/nginx/sites-available

Symlink conf file: ln -s /etc/nginx/sites-available/eg.conf /etc/nginx/sites-enabled/eg.conf



redis-server // start redis
redis-cli // start redis CLI



gem install bundler // install bundle
rvm osx-ssl-certs update all //Update RVM certifcates

Rails Routing Guide

HTTP Verb Path Controller#Action Used for
GET /photos photos#index display a list of all photos
GET /photos/new photos#new return an HTML form for creating a new photo
POST /photos photos#create create a new photo
You can’t perform that action at this time.