Skip to content

Instantly share code, notes, and snippets.

Anthony Rodriguez thonyx

Block or report user

Report or block thonyx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
thonyx /
Last active Apr 10, 2019
reload a running php-fpm in a docker container
docker exec -it container_name kill -USR2 1
thonyx /
Created Sep 30, 2018
add up all column values
res=0; for dir in $a; do val=$(du -s /dir_path | awk '{ print $1 }'); res=$(($val+$res)); done;
#The result is in KB by default
thonyx /
Last active Sep 29, 2018
Dealing with filesytems resizing
# 1 - Report file system disk space usage
# note: -h: human readable. print sizes in power of 1024.
$ df -h
# would print:
# Filesystem Size Used Avail Use% Mounted on
# udev 7.7G 0 7.7G 0% /dev
# tmpfs 1.6G 9.0M 1.6G 1% /run
# /dev/nvma1n1p1 59G 34G 25G 59% /
thonyx / traffic.js
Created Sep 3, 2018
a traffic light system
View traffic.js
let states = {
'red': {'nextSlot':'green', 'await':10000, 'exec':function(element){
element.className = 'red'
element.className = ''
'green': {'nextSlot':'yellow','await':10000, 'exec':function(element){
thonyx /
Last active Jul 28, 2018
Git blame a set of lines in a file
git blame -L 2014,+20 -- <file path>
thonyx /
Created Jul 19, 2018
Copy files over ssh using secure ssh (scp)
scp -r -i mykey.pem [from_directory_or_file] [host_name]:[destination_location]
thonyx /
Last active May 18, 2018
Store in a sorted set in Redis all unique values from keys matching a pattern using a shell command
redis="redis-cli -h host_name" \
$redis keys "*matching_key_pattern*" | awk -F':' '{print $2}' | awk '!x[$0]++' | xargs -I{} $redis zadd temp-user_ids {} {}
thonyx /
Created May 18, 2018
remove duplicates with awk
$ awk '!x[$0]++'
#which is a shorthand for:
$ awk ' !seen[$0] { print $0 } 1 { seen[$0]++ }'
thonyx /
Last active May 4, 2018
NGINX: Handle request with different PHP version driven by the URI resource name
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
location ^~ /endpoint {
alias /home/www/html;
try_files $uri $uri/ @nested;
thonyx /
Created Mar 13, 2018
deploy files into an s3 bucket from the cli
#s3 server deployment
aws s3 cp --acl public-read --content-type=text/html --metadata-directive REPLACE index.html s3://bucketname/index.html
You can’t perform that action at this time.