Category: ‘tech’
I have an encrypted home dir, which is automatically decrypted upon login. (Linux, if you were in doubt). I want to mount a large truecrypt partition automatically when i log in.

I wrote a small script that mounts the truecrypt drive. I added to .bashrc (you could also use .profile i guess) that this script automount script is mounted upon login.
Heres the initial script
truecrypt -t -k "" --auto-mount=devices -p 'MySuperSecretPassword'
Storing the password inside the script isnt the problem (remember that homedir is already encrypted). The problem is, when doing “ps ax”, the password shows up in the list, as such:
3471 ? Ssl 0:00 truecrypt -t -k --auto-mount=devices -p MySuperSecretPassword
Bad idea.. I want to mount using a password and not a “keyfile”, but truecrypt doesn’t provide any other way of supplying a password.
However the solution was pretty simple, once i found it.
echo "MySuperSecretPassword" | truecrypt -t -k "" --auto-mount=devices -p ''
Its really a coincidence that this works. Truecrypt tries to mount using a blank password.. Once this fails, it will prompt for a password.. The prompt will be filled from the pipe.. And now password is gone from ps ax and im a happy camper.
- Dan
Holland beware. Several thousand hackers & nerds from all over the world are marching towards your country.

At last, at last. Time to crawl outside our dungeons,
defy the Evil Daystar (even though it is trying to kill us) and make our way towards the “Hacking-At-Random” camp in Holland.
Its almost here!.. August 13-16.
We have moved all “camp” related stuff to our new blog on http://camp.hacker.dk. If you wish to follow our exploits (so-to-speak) while we’re there, camp.hacker.dk is the place to look. It will most likely be in Danish, but there will be photos (and cake!) so come on over anyway.
- Dan

After upgrading my subversion on my server to version 1.5.1, I started getting the following error for all newly created repositories (on commit):
svn: Can’t open activity db: APR does not understand this error code
Oddly, all my existing repositories worked fine. Googling didnt help me, though it did point to the direction that it was Apache not having enough rights. chmodding 770 didnt help. Chowning to www-data didnt help (both was the recomended solution everywhere i looked). Finally figured out that a folder was missing in the new project directory. This solved the problem for me:
$ cd /path/to/your/repository
$ mkdir dav
$ chown www-data: dav
So i thought id stick it online here, to help anyone else not finding the right solution on the web.
- Dan
Welp.. I finally surrendered.. I swore id never buy a gaming console and yet ive just bought my first one ever. Since i wanted a console that could play the games i usually play on a PC, i had the choice between the lesser of 2 evils. Sony vs. Microsoft.
After carefully weighing the proof against both companies, i decided that Sony was a bit more evil than MS, so i went with the XBOX 360. :)
One of the things i was looking forward to, was streaming video to the XBOX from my PC. Imagine my disappointment when the XBOX menu told me i needed a Windows PC with Windows Media Player 11.. No way in hell!.
So last night i finally got my Linux Laptop to stream vid to the XBOX. It turns out, that Microsofts mysterious “proprietary protocol” for streaming is (as usual) a standard protocol, just modified enough that standard tools cant use it. Why MS ALWAYS have to do this, boggles my mind. Its called a “standard” for a reason, dammit!.
The protocol in question is nothing more than UPnP.

AFAIK, the only difference from standard UPnP, is that the XBOX requires the UPnP server to identify it self as “Windows Media Connect” and it requires a specific directory layout.
“Fuppes” is a small UPnP server that lets you configure all this and even have guides on how to do it in their Wiki.
So now i have it working, and i have to admit that the XBOX media-player is not half bad (with the newest firmware upgrades). It does quite a decent job. Nothing fancy or cool, but works nicely.
- Dan
Presenting “sapi2wav”. (name choosen because text2wav was already taken)
Its a simple windows tool that allows you to do Text-To-Speech on command line.
The program will play a text given as argument or read a file and output to a wave file. It also allows you to choose other voices, if eg. you have NeoSpeech voices or AT&T Natural voices.
Its free (unlike any other commandline SAPI program ive found) and its Open Source (GPL).
Commandline processing is a MUST for any form of scripting or automation. I wanted to automaticly transfer daily news-stories to and MP3 player and now i can :)
Usage is as simple as:
sapi2wav.exe c:\out.wav 1 -t “Hello world”
TextAloud has a commandline mode, but its very oddly written, pretty beta and doesnt run under Linux. I wrote to Text Aloud (or NextUp.com) explaining my very insignificant problem and of course they didnt reply. So instead of buying their product, i ended up making an open source alternative :).
So if you install SAPI5 under wine (must be installed in windows ME compatability mode), then you can run this tool under wine as well and do commandline magic :)
Downloads:
Setting up MS-SAPI5 under wine should be as easy as configuring your wine to run in Windows ME mode, then download and run MS’s Sapi5 installer (msi - the Win ME version)
Winehq has an article on how to do this.
The tool SayPad from this page should have sapi5 included in the 95/98/me installer.. Though i havent testet it, i guess if you can install SayPad under wine, youll get the needed api’s.
please send me any changes you might make to this sapi to wav tool.
- Dan
Problem:PHP displays its version along with the normal webserver response headers. Apparently the only way to change this, is recompiling PHP. Which i find annoying to do after every PHP update.. So i decided to make a one-liner to patch the binary PHP module.
Solution:
This has been tested only on PHP4 and PHP5 on Debian, but i see no reason why it shouldnt work on other distro’s.
Locate your libphp4.so, libphp5.so or the likes. Mine is in /usr/lib/apache/1.3/libphp4.so (on Debian). And make a backup of it just in case ;)
Run the following command:
perl -pi -e "s/(X-Powered-By: PHP).([^\x00]+)/$1\x00$2/" /usr/lib/apache/1.3/libphp4.so
(replace /usr/lib/apache/1.3/libphp4.so with YOUR path)
Restart apache. Now headers only reveal “X-Powered-By: PHP"
- Dan
Ive been coding some perl for my Nokia 770 that needed to play sounds and i found that play-sound should do the trick. However the volume is very low and a lot of googling turned up nothing but other people with the same problem.
After analysing ‘play-sound’, i found out 2 things.
- It does use “esd” to play waves, which is good since its “non-blocking”.
- It’s made for playing “system-alert” sounds
So looking in the sound configuration, you can choose the volume level of system-alert sounds. The options are “none”,”level 1″ and “level 2″ and after raising my sound to level-2, it still wasnt loud enough. Also, i really dont want all other alert sounds at that volume.
So based on my (simple) analysis, the play-sound program reads a config option called “system_alert_volume”. So i thought there might also be a “master_volume” defined as well and did a small patch. And i was right.
So my solution is this (and requires perl on the tablet or an “offline” hex-edit):
Make a copy of play-sound:
$ cp /usr/bin/play-sound /usr/bin/play-sound2
Patch /usr/bin/play-sound2 to use “master_volume” instead. With perl, do this:
$ perl -pi -e 's/system_alert_volume/master_volume\x00...../' /usr/bin/play-sound2
Problem solved ;). Now you can use the command:
$ play-sound2 test.wav
to play sounds at the set master volume.
To do the same patch in a hex-editor, locate “system_alert_volume” and overwrite the string with “master_volume”, plus a “null” char (\x00) to terminate the string. If you forget to null-terminate, play-sound2 will segfault.
I like this solution, since “play-sound” is only 10k large and no extra dependencies needs to be filled.. And the “copy & patch” could be done from an install script.
- Dan