Snippets are one of my favorite parts of programming. The shear endless depth of command line tricks and customizations is so exciting! Here is a collection I maintain for myself to comeback to.

Also navigable by list of snippet types here.

See previous commit changes -- 11.01.2020 %

git log -p -2 or git lg -p -2

Viewing previous changes was something I relied on a GUI’s for, like GitLab/Source-Tree, until I found this command! The -p stands for –patch and the -2 stands for last two commits.


git docs

\- [ git ]

Aws S3 Sync -- 11.01.2020 %

$ aws s3 sync --acl public-read --sse AES256 build/ s3://

Having the ability to send a site live with a single command is heaven and not a BASH script with a bunch of moving parts liable to break. This command takes me back to the old days when putting a site live meant an FTP upload command to a server letting Apache take care of the rest. This site, for example, is hosted in an AWS S3 bucket that is connected to AWS CloudFront.


lustforge - great blog post

\- [ aws, s3 ]

AWS CloudFront invalidation Sync -- 11.01.2020 %

$ aws cloudfront create-invalidation --distribution-id E29OAXKYAP0NP8 --paths  /work/

Pairing well with the sync is invalidating the CDN so that the live site is updated immediately with the S3 bucket. Like everything these days, there is a cost involved with this operation so if I’m not in a rush I often avoid it. Also you can reduce cost by using –paths only invalidating needed routes.


lustforge - great blog post

\- [ aws ]

Pretty print JSON -- 11.01.2020 %

$ curl -X GET | python -m json.tool

Need to check a API request but stuck reading a garbled mess. Try pipeing the result to python json.tool



\- [ curl, json ]

Who Is Using that damn port? (Mac) -- 11.01.2020 %

$ sudo lsof -i:3000

Launching a process and it’s complaining about port being in use? With 100 shells running and os apps this can be hard to track down. Run this to get an idea of what to kill.



\- [ lsof ]
<---- back home