Software written in Bash.

name-by-date

name-by-date.sh is a bash script to rename JPEGs to show their creation date.

$ name-by-date.sh *.JPG
DSC_0350.JPG taken on "2010.07.02.08.36.20"
DSC_0356.JPG taken on "2010.07.02.08.38.10"
...

name-by-date.sh uses the exif command line interface to libexif to extract the date from the picture's metadata, so you'll have to install that first.

imapquota

imapquota.py is a Python script that checks the space remaining in an IMAP mail account using imaplib.

$ imapquota -s imap.mail.drexel.edu xyz12@drexel.edu
Password:
Used 92693 of 102400 KB
90.5 percent
bat

bat.sh is a bash script to display the available battery charge.

When I'm running X, I usually monitor battery charge with conky, but I wanted a script to allow quick status checks from the command line. You can dig into /sys/class/power_supply/ if you like, but the [acpi client][] (sys-power/acpi) provides a nicer interface:

$ acpi -b
Battery 0: Discharging, 99%, 05:06:14 remaining
cache-file

cache-file.sh is a bash script to make it easy to sort pictures using pqiv. If you place cache-file.sh in your path, and add

-1 "cache-file.sh -l saves"
-2 "cache-file.sh trash"
-2 "cache-file.sh -r"

to ~/.pqivrc, you can hard link the current picture to .cache-saves/ or by pressing 1, move the current picture to .cache-trash/ by pressing 2, or restore the current picture from the caches by pressing 3. The .cache-*/ directory is in the same directory as the image file, and will be created if it doesn't exist.

Not very complicated, but useful for quickly removing almost-duplicates, blurry pictures, etc.

passwd-gen

passwd-gen.sh is a /dev/random sanitizer for generating random passwords of various length and complexity.

$ ./passwd-gen.sh 16
WYQwDY0fVpfouu6O
Length of password: 16
Total bytes read:   73
Device:             /dev/random
Set:                [:alnum:]

The script is well commented, so there's not much more to say here...

Alarm

alarm.sh is a bash script wrapping at to minimize the number of keystrokes required to set a simple alarm. This one currently rings a bell and prints a message, but the possibilities are endless...

You will almost certainly have to adjust my ALARM_SOUND_CMD to play a file that exists on your system. Try locate *.wav to see what's already there, or grab something new :).

Image click locations

The clickloc.tk micro-app just opens an image file and prints out the pixel coordinates of any mouse clicks upon it. I use it to get rough numbers from journal figures. You can use scale click.py to convert the output to units of your choice, if you use your first four clicks to mark out the coordinate system (xmin,anything), (xmax,anything), (anything,ymin), and (anything,ymax).

$ pdfimages article.pdf fig
$ clickloc.tk fig-000.ppm > fig-000.pixels
$ scale_click.py 0 10 5 20 fig-000.pixels > fig-000.data

Take a look at plotpick for grabbing points from raw datafiles (which is more accurate and easier than reverse engineering images).

inotify

I just discovered inotify and it's command-line incarnation inotifywait (in inotify-tools on Debian). Now I can watch the data come in from home. If only I had the laser- and photodiode-alignment screws motorized... Anyhow, checkout monfold.sh.