Check These Out
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"
}
If you want to check that the spoof worked, type the same command as earlier:
$ifconfig en1 | grep ether
Now you will see:
$ether 00:e2:e3:e4:e5:e6
For the wired ethernet port:
$sudo ifconfig en0 ether 00:e2:e3:e4:e5:e6
(Please see sample output for usage)
Use any script name (the read command gets it) and it will be encrypted with the extension .crypt, i.e.:
myscript --> myscript.crypt
You can execute myscript.crypt only if you know the password. If you die, your script dies with you.
If you modify the startup line, be careful with the offset calculation of the crypted block (the XX string).
Not difficult to make script editable (an offset-dd piped to a gpg -d piped to a vim - piped to a gpg -c directed to script.new ), but not enough space to do it on a one liner.
Sorry for the chmod on parentheses, I dont like "-" at the end.
Thanks flatcap for the subshell abbreviation to /dev/null
https://github.com/rubygems/rubygems-mirror/issues/20
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
use find to grep all .c files from the target directory, cat them into one stream, then piped to wc to count the lines
Displays the same output as "cal", but with the current day highlighted (probably dependent on gnu grep, as I'm not sure other grep's support the "--color=auto" option). Tested and working on Ubuntu 11 and OSX Lion.
Installs pip packages defining a proxy
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Quick method of isolating filenames from a full path using expansion.
Much quicker than using "basename"