This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
history | awk '{CMD[\$2]++;count++;} END { for (a in CMD)print CMD[a] \" \" CMD[a]/count*100 \"% \"; }' | grep -v './' | column -c3 -s ' ' -t | sort -nr | nl | head -n10 | |
history | awk '{CMD[$2]++;count++;} END { for (a in CMD )print CMD[a] " " CMD[a]/count*100 "% " a }' | sort -nr | nl | column -t | head -n 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ vim ~/scripts/startup/simplevpn.sh | |
#!/bin/bash | |
/usr/bin/ssh -vfNT -p 8020 -o Compression=yes -o DynamicForward=9090 -o ServerAliveInterval=1 -L 5444:127.0.0.1:5432 username@remote.ip &>/dev/null & | |
❯ ~/scripts/startup/simplevpn.sh | |
❯ psql -U pg_user -d db_name -h localhost -p 5444 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is just a cheat sheet: | |
# On production | |
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz | |
# On local | |
scp -C production:~/database.sql.gz | |
dropdb database && createdb database | |
gunzip < database.sql.gz | psql database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
red='\e[91m' | |
green='\e[92m' | |
yellow='\e[93m' | |
magenta='\e[95m' | |
cyan='\e[96m' | |
none='\e[0m' | |
_red() { echo -e ${red}$*${none}; } | |
_green() { echo -e ${green}$*${none}; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def resize_nocrop_noscale(image, w,h) | |
w_original = image[:width].to_f | |
h_original = image[:height].to_f | |
if w_original < w && h_original < h | |
return image | |
end | |
# resize | |
image.resize("#{w}x#{h}") |
- Needs to download tools
- Discover Vagrant Boxes - Linux
- Two Vagrant boxes
- Master IP: 192.168.33.11 – read/write
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name linktr.cn; | |
include snippets/letsencrypt.conf; | |
return 301 https://$host$request_uri; | |
} | |
server { |
NewerOlder