Skip to content

Instantly share code, notes, and snippets.

@aaronbronow
aaronbronow / get-apt-packages.sh
Created March 26, 2019 21:23
list all installed packages
apt list --installed | sed -E 's/^(.*)\/.*/\1/'
gitlab-rake gitlab:backup:create
tar cfz /secret/gitlab/backups/$(date "+etc-gitlab-\%s.tgz") -C / etc/gitlab
@aaronbronow
aaronbronow / docker history by parent
Last active June 29, 2018 21:25
find linked docker parent and child images
for i in $(docker images -q)
do
docker history $i | grep -q $IMG && echo $i
done | sort -u
@aaronbronow
aaronbronow / sql_join.md
Last active May 25, 2018 07:53
sql join

JOIN

SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate FROM Orders INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID;

@aaronbronow
aaronbronow / grant_table_privilege_on_all_table_w_psql
Last active August 31, 2018 21:39 — forked from justinlewis/grant_table_privilege_on_all_table_w_psql
A simple function and some commands to grant privileges to every table in a PostgreSQL database. * each file is a different method. You don't need need to use them all in conjunction.
Use the commands below to set privileges using the PSQL terminal commands.
TABLES:
for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done
SEQUENCES:
for tbl in `psql -qAt -c "select sequence_name from information_schema.sequences where sequence_schema = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done
VIEWS:
for tbl in `psql -qAt -c "select table_name from information_schema.views where table_schema = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done
USER_EMAIL=aaron@aaronbronow.com
echo "Setting up your Ubuntu tools..."
wget -O ~/.bash_profile https://gist.githubusercontent.com/aaronbronow/17c442af81cb4e746b7cc95974f8a8cf/raw
source ~/.bash_profile
sudo apt-get --yes update
sudo apt-get --yes install vim git-core tig curl tmux openvpn
# setup vim
@aaronbronow
aaronbronow / proxy.sh
Created December 9, 2017 22:28
socks5 proxy running in docker
docker run -d --name socks5-proxy -p 443:1080 -e PROXY_USER=aaron -e PROXY_PASSWORD=password serjs/go-socks5-proxy
@aaronbronow
aaronbronow / get-ip.sh
Created December 9, 2017 22:11
get my public ip
dig +short myip.opendns.com @resolver1.opendns.com.
@aaronbronow
aaronbronow / 2-passwords.sh
Created December 8, 2017 03:05
get a short password-type string
### Thanks, ingy.net for this one that has no special package requirements
cat /dev/urandom | LC_CTYPE=C tr -cd a-zA-Z0-9+/ | fold -w12 | head -1
# or
openssl rand -base64 12
0x43a1aa25aA535958dc1cD2E7A59A97B44174fb0D