Check These Out
This will make your bash scripts better!!
process-getopt is a wrapper around getopt(1) for bash that lets you define command line options (eg -h, --help) and descriptions through a single function call. These definitions are then used in runtime processing of command line options as well as in generating help and man pages. It also saves a little time in coding and in producing nicely formatted documentation. It is quite similar to GNU's argp in glibc for compiled languages and OptionParse for python.
See: Linux Gazette article 162: http://tldp.org/LDP/LGNET/162/hepple.html,
http://sourceforge.net/projects/process-getopt, http://bhepple.freeshell.org/oddmuse/wiki.cgi/process-getopt
Most people take photos in landscape orientation (wider than it is tall). Sometimes though you turn the camera sideways to capture a narrow/tall subject. Assuming you then manually rotate those picture files 90 degrees for proper viewing on screen or photo frame, you now have a mix of orientations in your photos directory.
This command will print out the names of all the photos in the current directory whose vertical resolution is larger than its horizontal resolution (i.e. portrait orientation). You can then take that list of files and deal with them however you need to, like re-rotating back to landscape for consistent printing with all the others.
This command requires the "identify" command from the ImageMagick command-line image manipulation suite. Sample output from identify:
$ identify PICT2821.JPG
PICT2821.JPG JPEG 1536x2048 1536x2048+0+0 8-bit DirectClass 688KB 0.016u 0:00.006
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"
}
For each cpu set mask and then monitor your cpu infos. Temp,load avg. etc.
For example for 2nd cpu or 2nd core
taskset 0x00000002 yes > /dev/null &
For example for 3rd cpu or 3rd core
taskset 0x00000004 yes > /dev/null &
For example for 4th cpu or 4th core
taskset 0x00000008 yes > /dev/null &
Monitor your cpu temp with this command if you want
watch -n1 "acpi -t"
Load avg. from top command
top
kerim@bayner.com
http://www.bayner.com/
this will find text in the directory you specify and give you line where it appears.
The title is optional.
Options:
-t: expire time in milliseconds.
-u: urgency (low, normal, critical).
-i: icon path.
On Debian-based systems you may need to install the 'libnotify-bin' package.
Useful to advise when a wget download or a simulation ends. Example:
$ wget URL ; notify-send "Done"
This command gives you the charset of a text file, which would be handy if you have no idea of the encoding.