KoblentsBlog Photography
Contact About
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.)
1234
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:
123
$ mail -v -s "Test" name@host.com <<< 'Message Body'
name@host.com... Connecting to [127.0.0.1] via relay...
name@host.com... Deferred: Connection refused by [127.0.0.1]
Solution:
1
sudo vi /etc/mail/sendmail.cf
Then go down to the line that looks like this
1
O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
Add a new line, where Addr is your server's IP address (use ifconfig):
12
O DaemonPortOptions=Port=smtp,Addr=xx.xx.xx.xx, Name=MTA
O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
Then, depending on your distro, you'll do this or something similar:
1
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 Feb 28, 2017
Handy little script to concatenate video files. Probably wouldn't recommend it with dissimilar files, though.
123456789101112
#!/bin/bash

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

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.
 
Published Feb 21, 2017
I had an issue where a video file had embedded (soft) subtitles with an error, and I wanted to edit the subtitles. Since it's just a stream in the file, it's really easy - at least for an mkv container.
All you need to do is extract the subtitles, edit them in your editor of choice, then add the stream back in. Previously, I removed the subtitle stream from the file entirely then added the edited one back; the updated version simply uses the video and audio from the original file, and the subtitles from the edited srt file, to make the new video output.
123
ffmpeg -i <video.mkv> -an -vn -map 0:2 -c:s:0 srt <sub.srt>
vi <sub.srt>
ffmpeg -i <video.mkv> -i sub.srt -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s copy <video_output.mkv>
 
Published Jan 10, 2017
Looks like the backdoor roth will still be good for 2017.
If you're above the roth contribution income limits, it works like this:
1. Contribute to Traditional IRA
2. Convert (not recharacterize) to Roth IRA.
 
 
Archive: October 2016 »
© Copyright Koblents.com, 2012-2017