KoblentsBlog Photography
Contact About
Dust Trails
(1000px) (full)
Dust Trails Above Dunes
Moonlit Telescope
(1000px) (full)
Small Telescope At Lick Observatory

Published Aug 10, 2017
I use bluehost. I needed to set up a cron job to run a perl script. Unfortunately, it was failing silently; the cron job - according to their cpanel configuration - is supposed to mail you; but mail was not showing anything as it usually does for cron output.
If this describes your problem, the solution is simple: append 2>&1 to your command. This will put the errors into your output instead of silently ignoring them. Also, if you currently don't save output, do that too: /path/to/cmd > /path/to/log.txt 2>&1.
Published Jun 21, 2017
I needed to do a task that thrashes the filesystem a lot by creating many temporary files, then deleting them. Since all of this easily fits in a small ramdisk (I think these are 16 megabytes for my system, by default.)
So I figured, why not speed things up and reduce filesystem thrash with a ramdisk? I picked /dev/ram9, but it doesn't really matter; I also put it in /tmp so that it's not persistent (put it in /mnt and make an addition to /etc/fstab if you want it persistent.)
sudo mkfs -t ext3 /dev/ram9
mkdir /tmp/<name>
sudo mount /dev/ram9 /tmp/<name>/
sudo chown <user> /tmp/<name>/
That's it!
Published Jun 21, 2017
You might want to send out a mail from your server, which is running a (mostly) properly configured sendmail service, but it fails:
$ mail -v -s "Test" name@host.com <<< 'Message Body'
name@host.com... Connecting to [] via relay...
name@host.com... Deferred: Connection refused by []
sudo vi /etc/mail/sendmail.cf
Then go down to the line that looks like this
O DaemonPortOptions=Port=smtp,Addr=, Name=MTA
Add a new line, where Addr is your server's IP address (use ifconfig):
O DaemonPortOptions=Port=smtp,Addr=xx.xx.xx.xx, Name=MTA
O DaemonPortOptions=Port=smtp,Addr=, Name=MTA
Then, depending on your distro, you'll do this or something similar:
sudo service sendmail restart
And you're off and running.
Published Jun 4, 2017
Wanted to make a perl script that would generate a thumbnail sheet from a video. It seems that there are all sorts of tools out there that embed their own garbage onto the sheet - like watermarks - this doesn't.
Since this thrashes the filesystem, I put it on a ramdisk first, and mounted it on /tmp/thumbcreate.
Code after the jump. It's a bit of a prototype stage, but it's quite mature. Perl script:
Published Mar 31, 2017
Had to remove one of my headlights to fix it - it had the brass gear fix, but the bracket retaining the headlight motor gear cover was improperly installed, so it had broken loose. It was jittery while driving, didn't always go up or down all the way, allowed excessive side-to-side play, and was no longer waterproof...
Anyways, this process is fairly well documented on the corvette forum, and the other GM cars of that generation with popup headlights are fixed in much the same way.
There's only one thing missing: the wiring harness for the headlights and the headlight motor is clipped to the car, and it may seem impossible to take it off. That's because underneath, there is a clip, and it looks like this:
To take it off, you can either slide it forward - but mine was stuck, so I had to take the entire clip out. You'll need relatively thin, long needle-nose pliers, in order to push in the sides of the clip as you pull. Someone once posted this image, but it was a dead link, so hopefully it'll be helpful for you.
Key words for google: 1997-2004 (97-04) C5 corvette headlight motor wiring harness stuck or won't come out due to headlight harness retainer clip.
Published Mar 2, 2017
Neat article I found. I'm used to doing circuit board stuff; underhood wiring is new to me, so this was a big help.
Published Feb 28, 2017
Handy little script to concatenate video files. Probably wouldn't recommend it with dissimilar files, though.

if [[ -z $1 || -z $2 ]]; then
        echo "Must supply at least two arguments.";
        return 1;

ext=`echo $1 | sed -e "s/.*\.//"`;

ffmpeg -f concat -safe 0 \
       -i <(for f in "$@"; do echo "file '$PWD/$f'"; done) \
       -c copy output.$ext
Published Feb 26, 2017
Had an annoying bug that didn't seem to show up on google... so maybe this will resolve some issues.
I have a makefile where a build is attempted, but because the build tool is buggy, sometimes it fails for no reason. So I invoke it with a timeout, then test to see if it errored out, and if so I rerun the build. The error code in bash is $?; but inside of a makefile the $ needs to be escaped, so I write
if [ $$? -ne 0]; then
However, if you need to stick this into a makefile #define block, you need to escape the escaped $. If you don't, you'll get this error: -ne: unary operator expected. So you'll have to do this:
if [ $$$$? -ne 0 ]; then
in order to escape things properly.
Archive: February 2017 »
© Copyright Koblents.com, 2012-2017