Check These Out
Copy a file to a range of other files.
making it "sound" more "natural" language like -- additionally sorting the longest words alphabetically:
this approach is using:
* to get at all lines of input
* post-"for" structure
* short-circuit-or in sort: if the lengths are the same, then sort alphabetically otherwise don't even evaluate the right hand side of the or
* -C sets all input and ouput channels to utf8
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
No need to use perl, awk, nor /usr/bin/date -- bash's "printf" builtin will do it.
Do you ever want to know which day of week was your birhday! Now you can check that with this command, just set your birh date at the beginning (My bday in the example) and the dates will be revealed. ;)
this version only uses shell builtins
You can specify various output formats, theme styles, etc.
$ python -m pygments -o source.png source.py
$ python -m pygments -o source.rtf source.py
Check available output formats, styles, etc.:
$ python -m pygments -L
Find pygments module here: http://pygments.org/
Normally when a site is blocked through /etc/hosts, traffic is just being redirected to a non-existent server that isn't going to respond. This helps get your point across a little more clearly than a browser timeout.
Of course you could use any number of codes: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Obviously, this command can be added to init-rc.d, and more sophisticated responses can be given. Seems noteworthy to mention that the information sent from the browser can be parsed using the bash READ builtin (such as 'while read -t 1 statement; do parsing'), and the connection stays open until the script exits. Take care that you must use EXEC:'bash -c foo.sh', as 'execvp' (socat's method for executing scripts) invokes 'sh', not 'bash'.
Obviously the example given is necessarily simple, but this command not only saves time on the command line (saves you using "cd -" or, worse, having to type a fully qualified path if your command cd's more than once), but is vital in scripts, where I've found the behaviour of "cd -" to be a little broken at times.