Do you ever spend 20 minutes figuring out the perfect way to do some arcane task on the command line, only to forget it and need it again in a month? I do. A lot.
I started keeping a directory with little plain text documents that had the command line I wanted inside them. I recently uploaded them to my static site and wrote a script to use them easier.
It’s real simple, just download the howto bash script in the following directory http://static.velvetcache.org/howtos/ and place it in your path. Now make a directory for your HowTo’s somewhere and put the whole path into a file in your home directory called “.howto”.
You should be able to call $ howto --sync and it will pull down a tar of the most current files, then expand it into your HowTo directory.
If you download the howto.tar.gz by itself, be warned that it is a tar bomb and will rudely scatter its files all over your directory.
Lastly, onceyou have some HowTo’s installed, just use $ howto -l to list out the possible choices, then $ howto print-unix-timestamp, replacing “print-unix-timestamp” with the name or number of the HowTo you want.
Below is the howto shell script, because I like including code in my posts whenever I can.
#!/bin/bash
function printUsage {
echo "Usage: howto [-l | --list] file-name"
exit 1
}
if [ $# -ne 1 ]; then
printUsage
fi
if [ ! -f ~/.howto ]; then
echo "No .howto file found in your home directory!"
exit 1
fi
HOWTODIR=$(cat ~/.howto)
if [ "$1" == "--sync" ]; then
LRECENT=$(cat $HOWTODIR/CURRENT)
SRECENT=$(wget -O - http://static.velvetcache.org/howtos/CURRENT 2> /dev/null)
if [ $? -ne 0 ]; then
echo "Can't contact download server."
exit 1
fi
if [ "$LRECENT" != "$SRECENT" ]; then
cd $HOWTODIR
if [ $? -ne 0 ]; then
echo "Can't change to the HowTo directory."
exit 1
fi
wget -O howtos.tar.gz http://static.velvetcache.org/howtos/howtos.tar.gz
if [ $? -ne 0 ]; then
echo "Can't download new files."
exit 1
fi
tar -zxf howtos.tar.gz
if [ $? -ne 0 ] ; then
echo "Can't untar the updates."
exit 1
fi
rm -f howtos.tar.gz
exit 0
else
echo 'Nothing new to download.'
exit 0
fi
fi
if [ "$1" == "--list" ] || [ "$1" == "-l" ]; then
COUNTER=0
for howto in `ls $HOWTODIR`; do
echo "$COUNTER $howto"
COUNTER=$(expr $COUNTER + 1)
done
exit 0
fi
echo $1 | grep '^[0-9][0-9]*$' > /dev/null 2>&1
if [ $? -eq 0 ]; then
COUNTER=0
for howto in `ls $HOWTODIR`; do
if [ $COUNTER -eq $1 ]; then
cat $HOWTODIR/$howto
exit 0
fi
COUNTER=$(expr $COUNTER + 1)
done
echo 'That HowTo was not found.'
exit 1
elif [ ! -f "$HOWTODIR/$1" ]; then
echo 'That HowTo was not found.'
exit 1
fi
cat $HOWTODIR/$1
exit 0
It’s been about a month and a half since I started re-writing OurUNO in a nice, intelligent, frameworked system with Smarty and I ran CLOC on my source dir today. CLOC doesn’t do Smarty templates, so I ran them as HTML, close enough, right?
74 text files.
74 unique files.
640 files ignored.
http://cloc.sourceforge.net v 1.00 T=1.0 s (73.0 files/s, 4918.0 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code scale 3rd gen. equiv
-------------------------------------------------------------------------------
PHP 40 723 140 2370 x 3.50 = 8295.00
HTML 24 151 17 1036 x 1.90 = 1968.40
CSS 6 50 23 345 x 1.00 = 345.00
Javascript 2 10 0 47 x 1.48 = 69.56
Bourne Shell 1 1 4 1 x 3.81 = 3.81
-------------------------------------------------------------------------------
SUM: 73 935 184 3799 x 2.81 = 10681.77
-------------------------------------------------------------------------------
What I like is that my PHP files are ~23% empty space, and the one shell script has only 1 line of code. Now, the PHP is all new as is most of the javascript and some of the TPL files. So even saying a 60% cut on JS, CSS & TPL, thats still 3728 lines of code in the spare time from about a month and a half, so about 83 lines a day. It’s amazing what as little as 83 lines a day can do.
Released Nix 0.7 today. It’s a minor-ish update that mostly just adds a bunch of cpu icons to the configurator.
Download Nix 0.7
So I finished Fate/stay night a few evenings ago. It’s 24 episodes and I really, really enjoyed it. Definitely in my top three.
The art varied a little bit, with some stellar work and some average fare, but overall it tended towards good I thought. Some things in the storyline went a bit under-explained, but that’s really to be expected from an anime made after a detailed game.
What made this show so great were the characters and how they interacted and grew. Really great relationships, even if the dialog was a bit spotty. I also had the fan sub version, so that might have contributed to weak dialog as they tend to be in a rush to publish. Make no mistake though, very good storyline and very good character development.
The only thing I outright didn’t like was the ending. It wasn’t necessarily a bad ending, it was quite powerful and brought closure to the sotry, but it just wasn’t the one I would have preferred. A follow up series would be awesome, and could fix the ending for me, but as far as I know isn’t really in the works.
Overall a great show, I give it an A.
You have got to love MySpace. Their code has got to be so nasty, I mean, just the markup on a profile makes me sick to my stomach, I can’t imagine the pasted together backend that would generate that mess.
When I got an event invitation I went to RSVP and had a thought. I wondered how well they error checked their inputs. I mean, I’m sure they strip and escape for SQL injection, but do they constrain anything?
I busted out Firebug, edited the source for the RSVP and now I’m bringing several tens of thousands of friends with me to the party. Awesome.
Click for biggies.


(Note: the 91213 didn’t work, too big I bet)