Check These Out
Working with lists of IP addresses it is sometimes useful to summarize a count of how many times an IP address appears in the file.
This example, summarizeIP, uses another function "verifyIP" previously defined in commandlinefu.com to ensure only valid IP addresses get counted. The summary list is presented in count order starting with highest count.
This command takes a 1280x1024 p picture from the webcam.
If prefer it smaller, try changing the -s parameter: qqvga is the tiniest, vga is 640x480, svga is 800x600 and so on.
Get your smile on and press enter! :)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Only works for integer arithmetic.
You can use this in a script which rotates wallpapers from a directory at each login.
A quick and simple way of outputting the start and end date of a certificate, you can simply use 'openssl x509 -in xxxxxx.crt -noout -enddate' to output the end date (ex. notAfter=Feb 01 11:30:32 2009 GMT) and with the date command you format the output to an ISO format.
For the start date use the switch -startdate and for end date use -enddate.
Optimal way of deleting huge numbers of files
Using -delete is faster than:
$ find /path/to/dir -type f -print0 | xargs -0 rm
$ find /path/to/dir -type f -exec rm {} +
$ find /path/to/dir -type f -exec rm \-f {} \;
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
for the change stay in your history file , export command by writing it into your .bashrc