-
Build two boxes and install ubuntu18.04
- box1: master -> Ubuntu 18.04 with PG 12
- static ip: 192.168.33.33
- hostname: master
- box2: slave -> Ubuntu 18.04 with PG 12
- static ip: 192.168.33.44
- hostname: slave
- box1: master -> Ubuntu 18.04 with PG 12
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
#!/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}; } |
- 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
❯ 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
FROM ubuntu | |
# MAINTAINER email#dot.com | |
# Add the PostgreSQL PGP key to verify their Debian packages. | |
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc | |
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 | |
# Add PostgreSQL's repository. It contains the most recent stable release | |
# of PostgreSQL, ``9.6``. | |
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list |
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}") |
NewerOlder