A collection of handy one-liners and snippets by Paul Engel
bash -c 'source /path/to/your/.env; echo $MYENVVAR'
fish -c 'source /path/to/your/.env; echo $MYENVVAR'
mysqldump -u root awesome_database | gzip -c | cat > ~/awesome_database.sql.gz
gunzip < ~/awesome_database.sql.gz | mysql -u root awesome_database
ls | xargs -Idir tar -czf dir.tar.gz dir
ls *.tar.gz | xargs -Ifile tar -xzvf file
bq query --destination_table=<project_id>:<data_set>.<table> "SELECT foo, bar FROM [<project_id>:<data_set>.<table>]"
bq extract --project_id=<project_id> --destination_format=CSV -F"\t" <data_set>.<table> gs://my_bucket/file.tsv
gsutil -m mv gs://my_bucket/dir gs://other_bucket/dir
SELECT ADDDATE("1970-01-01", d0.i + (d1.i * 10) + (d2.i * 100) + (d3.i * 1000) + (d4.i * 10000)) day
FROM
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) d0,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) d1,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) d2,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) d3,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) d4
HAVING day >= "2015-02-02" AND day <= "2015-04-26"
ps -p PID -o etime=
yum list installed | grep -i mysql
yum remove mysql mysql-*
sudo yum install MySQL-python
sudo truncate -s0 /path/to/file
lsof -i
netstat -a
git log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
ssh -L 3307:remote_mysql:3306 me@ssh_host
free && sync && echo 3 > /proc/sys/vm/drop_caches && free
lsof -iTCP -sTCP:LISTEN -n -P