Useful commands from my shell history
My shell history is pretty boring, mostly a lot of npm
and git
, but there are a handful specific commands I need infrequently, and that I always pull up by Ctrl+R
-ing through my shell because the commands themselves are too long and weird to commit to memory.
I'm documenting those here, should my shell history ever be lost.
Convert a web extension to a Safari web extension:
Safari "supports" web extensions, except you still have to convert them and build them with Xcode. I don't quite know what the logic is for when this command has to be run/rerun—it seems to be whenever a new file is added. Changed files get picked up by Xcode, I think? I really don't like building web extensions for Safari.
xcrun safari-web-extension-converter web-extension/path --project-location web-extension/safari --macos-only
Convert an .mp4 video to a .webm video:
ffmpeg -i VIDEO_NAME.mp4 -c:v libvpx-vp9 -pix_fmt yuva420p VIDEO_NAME.webm
Sync a specific file type to AWS S3, with multi-factor authentication enabled:
For example, this command will sync only .json
files:
aws s3 sync . s3://your/directory/path --exclude "*.*" --include "*.json" --profile mfa --dryrun
Note: that command has the --dryrun
flag. It won't actually do anything—it will just tell you what it will do without flag. Remove --dryrun
to do it for real.
AWS multi-factor auth:
aws sts get-session-token --serial-number SERIAL_NUMBER_HERE --token-code TOKEN_CODE_HERE