MPD add random Album

Just a quicky for today.. I could have sworn that there was a oneliner on commandlinefu.com (which is a great page btw!) to add a random album to MPD (Music Player Daemon), but I wasn’t able to find it. So time to quickly build one on my own..
These are the few lines to put in your .bashrc, so you can then just type ‘mpd_randomadd’ or ‘mpd_randomreplace’ and you’ll get a new-random album added. The tracks will stay in order, don’t worry.

MUSICDIR="/home/user/music"
MPDHOST="linuxbox"
alias mpd_randomadd='mpc -h $MPDHOST add "$(cd $MUSICDIR; find -follow -mindepth 1 -type d | shuf | head -n1 | cut -b3- ; cd ->/dev/null)"'
alias mpd_randomreplace='mpc -h $MPDHOST clear ; mpc -h $MPDHOST add "$(cd $MUSICDIR ; find -follow -mindepth 1 -type d | shuf | head -n1 | cut -b3- ; cd ->/dev/null)"; mpc -h $MPDHOST play'

Ask if you have questions ;-)

Cheers,
Raphi

Posted in scripts, tech | Tagged , , , , , | Leave a comment

Bash – Multithreading

In the age of multi-core CPU’s, there’s also a need for properly optimized application. Since the vast majority of the linux utilities only allow you to specify ONE input/output file, it’s our job to script it to exhaust all the Cores.
When I got my first multi-core CPU about one year back, I was not aware of any method to launch several threads except for the ampersand-thingy (like ‘echo &’) so I could launch them in the background. The problem of course is that there’s not an easy way to limit the number of concurrent threads, so we need to be more creative.
Continue reading

Posted in scripts, tech | Tagged , , , , , | 3 Comments

Export Android SMS to .mbox file

In the past I’ve been using Gammu / Wammu to connect my mobile to my computer. One of the features I liked most, was the sms-export. It allows you to export into the native-gammu-format, into an .mbox file or directly upload it to an IMAP server. I kept exporting them as .mbox so I could reimporting it in Thunderbird using ImportExportTools (MboxImport enhanced).
Recently I’ve switched to my precious ‘Motorola Milestone’, which runs Android. So time to lookout for a new solution, since Gammu / Wammu don’t support Android.
Continue reading

Posted in android, scripts, tech | Tagged , , , | Leave a comment

Handle Exchange 2007 mailbox-limits using Powershell and Customattribute15 (ADS)

In my last job, I was responsible for our exchange-environment (Exchange 2007), where we’ve had a lot of users with HUGE mailboxes. They kept requesting new/adjusted limits all the time, so instead of ‘wasting’ our ‘engineers-time’ for all the requests, we’ve came up with a pretty nice solution; we’ve handed this task over to our 1st level support, but without giving them access to the exchange-environment. I instead wrote a script, that applies predefined limits according to the ‘Customattribute15′ (CA15) in Activedirectory.
Continue reading

Posted in scripts, tech | Tagged , , , , , | Leave a comment

chroot abused as virtualization SW

As the title indicates, this article will show you an example usage of chroot, where we’ll clone our currently running system into a disk-image (dd). Doing that, we can afterwards loop-mount it, chroot in it and let all the stuff run, that we don’t want on our mainbox. On my box, for example, I’ve removed all the compilers and dev-libraries and I’m using this approach to keep it fast, lightweight and clean.
Continue reading

Posted in tech, virtualization | Tagged , , | Leave a comment