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
rsyncs files to a server excluding listed files
also a file can be used to exclude common exclude rules and/or to exclude a ton of files, like so:
$rsync --exclude-from '~/.scripts/exclude.txt'
where exclude.txt has one rule per line:
*.mp3
*.svn*
The command uses ssh(1) to get to a remote host, uses tar(1) to archive a remote directory, prints the result to STDOUT, which is piped to gzip(1) to compress to a local file. In other words, we are archiving and compressing a remote directory to our local box.
I wanted to create a copy of my whole laptop disk on an lvm disk of the same size.
First I created the logical volume: lvcreate -L120G -nlaptop mylvms
SOURCE: dd if=/dev/sda bs=16065b | netcat ip-target 1234
TARGET: nc -l -p 1234 | dd of=/dev/mapper/mylvms-laptop bs=16065b
to follow its process you issue the following command in a different terminal
STATS: on target in a different terminal: watch -n60 -- kill -USR1 $(pgrep dd)
(see http://www.commandlinefu.com/commands/view/4356/output-stats-from-a-running-dd-command-to-see-its-progress)
When you fill a formular with Firefox, you see things you entered in previous formulars with same field names. This command list everything Firefox has registered. Using a "delete from", you can remove anoying Google queries, for example ;-)
nmap accepts a wide variety of addressing notation, multiple targets/ranges, etc.
Convert readable date/time with `date` command
Prerequisites: module Pod::Webserver installed. You can install it typing:
$ sudo perl -MCPAN -e 'install Pod::Webserver'
You can replace elinks with your fav browser. For FF:
$podwebserver& sleep 2; firefox -remote 'openurl( http://127.0.0.1:8020/, new-tab )'
If you have Firefox open, this will pop-up the index web in a new tab.