Check These Out
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token.
This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use:
`awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'`
You must adapt the command line to include:
* $MFA_IDis ARN of the virtual MFA or serial number of the physical one
* TTL for the credentials
Finds the date of the first commit in a git repository branch
You can record, then replay a series of keystrokes in vim. In command mode 'q', then a letter [a-zA-Z] starts macro recording mode. Enter a series of vim commands. When done, enter command mode again, and press 'q' to stop recording.
To replay, enter command mode, then press @{letter}
Don't do this:
$echo word | command
Using a bash "here strings" and "here documents" look leeter than piping echo into the command. Also prevents subshell execution. Word is also expanded as usual.
Query the Socrata Open Data API being used by the White House to find any employee's salary using curl, grep and awk.
Change the value of the search parameter (example uses Axelrod) to the name of any White House staffer to see their annual salary.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
This is a beginning script. You can create a file with > filename. You can also use diff to compare output run at different times to verify no change in your files. I apologize in advance if this is too simple. For some it should be a start.
Extracts an MP3 encoded audio stream from an input video file.
This replaces the current bash session with a new bash session, run as an interactive non-login shell... useful if you have changed /etc/bash.bashrc, or ~/.bashrc
If you have changed a startup script for login shells, use
$ exec bash -l
Suitable for re-running /etc/profile, ~/.bash_login and ~/.profile.
edit: chinmaya points out that
$ env - HOME=$HOME TERM=$TERM bash -s "exec bash -l"
will clear any shell variables which have been set... since this verges on unwieldy, might want to use
$ alias bash_restart='env - HOME=$HOME TERM=$TERM bash -s "exec bash -l"'