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
or "Execute a command with a timeout"
Run a command in background, sleep 10 seconds, kill it.
$! is the process id of the most recently executed background command.
You can test it with:
find /& sleep10; kill $!
Friday is the 5th day of the week, monday is the 1st.
Output may be affected by locale.
Good for one off jobs that you want to run at a quiet time. The default threshold is a load average of 0.8 but this can be set using atrun.
Using mplayer's mencoder, you can merge video files together.
'-oac' specifies the audio encoding (here copy, to just copy and not compress)
'-ovc' specifies the video encoding (same thing).
When some console full-screen program (minicom, vi, some installers) breaks down your terminal, try this command to revert all options to "sane" settings (sane is a built-in combo of a lot of stty options)
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
to convert a whole directory, put all mp3 files in a for loop
$ for i in $(ls *mp3); do mpg123 -s $i | faac -b 80 -P -X -w -o ${i%mp3}m4b -; done
This command outputs a table of sighting opportunities for the International Space Station. Find the URL for your city here: http://spaceflight.nasa.gov/realdata/sightings/