Check These Out
Will stop all running containers, then remove all containers
**This isn't for selectively handling containers, it removes everything**
This will calculate the your commandlinefu votes (upvotes - downvotes).
Hopefully this will boost my commandlinefu points.
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"
}
You can use a site like http://www.jsonlint.com/ or use the command line to validate your long and complex json data. This is part of the simplejson package for python http://undefined.org/python/#simplejson.
Wrong json expression example:
$ echo '{ 1.2:3.4}' | python -m simplejson.tool
Expecting property name: line 1 column 2 (char 2)
This creates a persistent ssh -i /path/to/key -ND local-IP:PORT User@Server connection. You may have to install autossh. -f puts in daemon mode. if you are having trouble, try it without -f.
I doubt this works with other than bash, but then again, I havent tried.
The 'yes' utility is very simple, it outputs a hell of a lot of 'y's to standard input.
The '!!' command means 'the last command'. So this one-lines inputs a lot of y's into the last command, aggressively agreeing to everything. For instance, when doing apt-get.
Usage: flight_status airline_code flight_number (optional)_offset_of_departure_date_from_today
So for instance, to track a flight which departed yesterday, the optional 3rd parameter should have a value of -1.
eg.
flight_status ua 3655 -1
output
---------
Status: Arrived
Departure: San Francisco, CA (SFO)
Scheduled: 6:30 AM, Jan 3
Takeoff: 7:18 AM, Jan 3
Term-Gate: Term 1 - 32A
Arrival: Newark, NJ (EWR)
Scheduled: 2:55 PM, Jan 3
At Gate: 3:42 PM, Jan 3
Term-Gate: Term C - C131
Note:
html2text needs to be installed for this command. only tested on ubuntu 9.10
If you use 'tail -f foo.txt' and it becomes temporarily moved/deleted (ie: log rolls over) then tail will not pick up on the new foo.txt and simply waits with no output.
'tail -F' allows you to follow the file by it's name, rather than a descriptor. If foo.txt disappears, tail will wait until the filename appears again and then continues tailing.