tags/bashunfolding disastershttp://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/unfolding disastersikiwiki2011-02-01T17:27:25Zname-by-datehttp://www.physics.drexel.edu/~wking/unfolding-disasters/posts/name-by-date/2011-02-01T17:27:25Z2011-02-01T16:44:58Z
<p><a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/name-by-date/name-by-date.sh">name-by-date.sh</a> is a <a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/Bash/">bash</a> script to rename JPEGs to show their
creation date.</p>
<pre><code>$ 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"
...
</code></pre>
<p><code>name-by-date.sh</code> uses the <code>exif</code> command line interface to
<a href="http://libexif.sourceforge.net/">libexif</a> to extract the date from the picture's metadata, so you'll
have to install that first.</p>
bathttp://www.physics.drexel.edu/~wking/unfolding-disasters/posts/bat/2011-02-01T15:57:07Z2011-02-01T15:57:07Z
<p><a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/bat/bat.sh">bat.sh</a> is a <a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/Bash/">bash</a> script to display the available battery charge.</p>
<p>When I'm running X, I usually monitor battery charge with <a href="http://conky.sourceforge.net/">conky</a>,
but I wanted a script to allow quick status checks from the command
line.</p>
<pre><code>$ bat.sh
Full 4400000/4400000 (100.0%)
</code></pre>
imapquotahttp://www.physics.drexel.edu/~wking/unfolding-disasters/posts/imapquota/2011-02-01T15:57:07Z2011-02-01T15:57:07Z
<p><a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/imapquota/imapquota.py">imapquota.py</a> is a <a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/Python/">Python</a> script that checks the space
remaining in an <a href="http://en.wikipedia.org/wiki/Internet_Message_Access_Protocol">IMAP</a> mail account using <a href="http://docs.python.org/library/imaplib.html">imaplib</a>.</p>
<pre><code>$ imapquota -s imap.mail.drexel.edu xyz12@drexel.edu
Password:
Used 92693 of 102400 KB
90.5 percent
</code></pre>
cache-filehttp://www.physics.drexel.edu/~wking/unfolding-disasters/posts/cache-file/2011-02-01T15:25:28Z2011-02-01T15:25:28Z
<p><a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/cache-file/cache-file.sh">cache-file.sh</a> is a <a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/Bash/">bash</a> script to make it easy to sort
pictures using <a href="http://www.pberndt.com/Programme/Linux/pqiv">pqiv</a>. If you place <code>cache-file.sh</code> in your path,
and add</p>
<pre><code>-1 "cache-file.sh saves"
-2 "cache-file.sh trash"
</code></pre>
<p>to <code>~/.pqivrc</code>, you can move the current picture to <code>.cache-saves/</code> or
<code>.cache-trash/</code> by pressing 1 or 2 respectively. The <code>.cache-*/</code>
directory is in the same directory as the image file, and will be
created if it doesn't exist.</p>
<p>Not very complicated, but useful for quickly removing
almost-duplicates, blurry pictures, etc.</p>
passwd-genhttp://www.physics.drexel.edu/~wking/unfolding-disasters/posts/passwd-gen/2010-11-21T01:02:01Z2010-11-21T01:02:01Z
<p><a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/passwd-gen/passwd-gen.sh">passwd-gen.sh</a> is a <code>/dev/random</code> sanitizer for generating random
passwords of various length and complexity.</p>
<pre><code>$ ./passwd-gen.sh 16
NEmXOH2djJvUamdh
Length of password: 16
Total bytes read: 52
</code></pre>
<p>The script is well commented, so there's not much more to say here...</p>
Alarmhttp://www.physics.drexel.edu/~wking/unfolding-disasters/posts/Alarm/2010-11-20T20:24:09Z2010-11-20T20:24:09Z
<p><a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/Alarm/alarm.sh">alarm.sh</a> is a <a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/Bash/">bash</a> script wrapping <a href="http://packages.qa.debian.org/a/at.html">at</a> 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...</p>
<p>You will almost certainly have to adjust my ALARM_SOUND_CMD to play a
file that exists on your system. Try <code>locate *.wav</code> to see what's
already there, or grab something new :).</p>
Bashhttp://www.physics.drexel.edu/~wking/unfolding-disasters/posts/Bash/2010-11-20T20:05:16Z2010-11-20T20:05:16Z
<p>The <a href="http://www.gnu.org/software/bash/">Bourne Again Shell</a> is a very widely adopted <a href="http://en.wikipedia.org/wiki/Unix_shell">Unix
shell</a>, and is the default shell for many distributions.
Mendel Cooper's <a href="http://tldp.org/LDP/abs/html/">Advanced Bash Scripting Guide</a> is an excellent
resource, and there is also a nicely detailed <a href="http://www.gnu.org/software/bash/manual/">manual</a>.</p>
Image click locationshttp://www.physics.drexel.edu/~wking/unfolding-disasters/posts/clickloc/2010-11-18T14:41:21Z2010-11-18T14:41:21Z
<p>The <a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/clickloc/clickloc.tk">clickloc.tk</a> 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 <a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/clickloc/scale_click.sh">scale click.sh</a> 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).</p>
<pre><code>$ pdfimages article.pdf fig
$ clickloc.tk fig-000.ppm > fig-000.pixels
$ scale_click.sh 0 10 5 20 fig-000.pixels > fig-000.data
</code></pre>
<p>Take a look at <a href="http://www.physics.drexel.edu/~wking/unfolding-disasters/tags/bash/../../posts/plotpick/">plotpick</a> for grabbing points from raw datafiles
(which is more accurate and easier than reverse engineering images).</p>