Tag: hacks
Google Earth trip video capture in GNU/Linux with Yukon/Seom
by plouj on Jul.15, 2009, under GNU/Linux, HOWTO, hacks, tools, video
This is documentation of how I used Yukon and Seom to video capture a Google Earth trip for a recent video project in Fedora 10. I used the official installation guide as a starting point.
Compile the Seom library
I choose to install both Seom and Yukon in a custom prefix /home/plouj/yukon, rather than the system wide /usr or /usr/local.
$ svn co https://devel.neopsis.com/svn/seom/branches/packetized-stream seom $ cd seom $ ./configure --prefix=/home/plouj/yukon --arch="x86" --cflags="-W -Wall" && \ make CC="gcc -m32" && make install LIBDIR="lib"
Note that “–arch=”x86″ and “-m32″ are only necessary for me because my operating system is 64bit and I need 32bit versions of seom and yukon (to work with 32bit Google Earth).
Compile and install Yukon
$ svn co https://devel.neopsis.com/svn/yukon/branches/rewrite yukon $ cd yukon $ ./configure --prefix=/home/plouj/yukon/ --libdir="lib" --arch="x86" && \ make CC="gcc -L/home/plouj/yukon/lib -I/home/plouj/yukon/include -m32" && \ make install
Install Google Earth for Linux
Obviously get it here: http://earth.google.com/
Modify the Google Earth startup script
Since I chose /home/plouj/bin/ as the “Binary path” for Google Earth I was editing /home/plouj/bin/googleearth. All I had to do was to add yukon/seom library and executable paths at the end of the script:
...
cd "${GOOGLEEARTH_DATA_PATH}/"
LD_LIBRARY_PATH=/home/plouj/yukon/lib/:$LD_LIBRARY_PATH \
PATH=/home/plouj/yukon/bin:$PATH exec yukon "./googleearth-bin" "$@"
instead of the original:
cd "${GOOGLEEARTH_DATA_PATH}/"
exec "./googleearth-bin" "$@"
Capture
Finally, the capture process is well documented on the Yukon website.
Quake1 demo recorded on the Wii
by plouj on Aug.19, 2008, under fun
I wastedspent today’s evening playing around with Quake1 which I installed on my brother’s Wii through the Homebrew channel. One cool thing that I managed to get working relatively painlessly was demo recording.
Since there is no keyboard support in Quake1 yet, I had to add the following bind to the /id1/config.cfg file on the SD card using a desktop computer:
bind "UPARROW" "disconnect; skill 3; record wii; map e1m1"
This allowed me to simply press the up arrow button on the Wii remote and Quake1 would start recording a demo of me playing the first level of the first episode on Nightmare difficulty.
So far, I haven’t been able to play the game as quickly and as precisely as I can on a computer with a mouse. Not that I’m a great Quake player to begin with. However, I still had a lot of fun, especially after I started using the Wii Zapper. It gave me a nice sensation of holding boom stick, but didn’t improve my aim.
Here is the actual demo bzip2 archive for those who really want to watch me get owned by zombies from another dimension for a few minutes. This demo should be playable with most Quake1 engines and original (full version or demo) game data from ID. I used my personal favourite – Darkplaces:

.
These screenshots sort-of show that I’m shooting at stuff which is not directly under my cross-hair because of the way Wii remote look works. In the actual Wii Quake, the gun model also moves around the screen.
TAP that DHCP bridge for some Qemu TUN in Fedora
by plouj on Jul.29, 2008, under HOWTO
The other day I needed to setup bridged networking for a Qemu virtual machine. Although I found a rather well written generic TAP interfaces guide on Wikibooks. It only explained how to configure a network bridge on a host machine with a static IP. I wanted to do this on a host that used DHCP. Plus I wanted to keep all configuration in Fedora specific places. Having discovered a good way to do this through experimentation after a few fruitless Google searches I thought it would be useful for myself and others to have the configuration documented here.
ifcfg-eth0
First, I changed the host’s (auto-generated) /etc/sysconfig/network-scripts/ifcfg-eth0 script from this:
# Attansic Technology Corp. L1 Gigabit Ethernet Adapter DEVICE=eth0 BOOTPROTO=dhcp HWADDR=00:1D:60:35:A7:64 ONBOOT=yes
to this:
# Attansic Technology Corp. L1 Gigabit Ethernet Adapter DEVICE=eth0 TYPE=Ethernet BRIDGE=br0 ONBOOT=yes
This turns off DHCP on the physical Ethernet device and just specifies that it will be connected to or a part of a bridge.
ifcfg-br0
Second, I created /etc/sysconfig/network-scripts/ifcfg-br0, which will be called to setup a bridge device:
DEVICE=br0 TYPE=Bridge BOOTPROTO=dhcp HWADDR=00:1D:60:35:A7:64 ONBOOT=yes DELAY=0 STP=off
As you can see, most of this configuration is copied from eth0 plus the bridge configuration as per the Qemu Wikibook.
qemu-ifup/down
Third, I shortened the /etc/qemu-ifup and /etc/qemu-ifdown from Wikibooks to get this:
/etc/qemu-ifup:
#!/bin/sh USER=$(id -un) sudo /usr/sbin/openvpn --mktun --dev $1 --user "$USER" sudo /sbin/ifconfig $1 0.0.0.0 promisc up sudo /usr/sbin/brctl addif br0 $1
/etc/qemu-ifdown:
#!/bin/sh sudo /sbin/ifconfig $1 down sudo /usr/sbin/brctl delif br0 $1 sudo /usr/sbin/openvpn --rmtun --dev $1
Here I basically removed all of the configuration that is taken care of in the sysconfig scripts. I also made explicit use of sudo simply because that is my preference.
Final steps
Now I can simply run /etc/qemu-ifup tap0 once to create a TAP device, and use something like: qemu-kvm -hda /virtual-machines/fedora9.disk -m 512 -net nic -net tap,ifname=tap0,script=no to start a virtual machine. When I’m done running the virtual machine, I can run /etc/qemu-ifdown tap0 to remove the TAP device.
All this sounds simple now that it’s working, but initially it took a lot of guessing on my part so I’m documenting it here for the future.
I would appreciate it if someone can point me to the official Redhat/Fedora documentation on editing /etc/sysconfig/network-scripts/ scripts.
HOWTO: run rTorrent from Cron inside Screen at boot
by plouj on Mar.31, 2008, under HOWTO, tools
Once I figured out how to do QoS on my openwrt router I decided that I would make use of the bandwidth provided to me by my ISP to seed some nice legal torrents as long as I can without interrupting my Internet browsing. Since I was already using rTorrent, it seemed like a good choice for a console application running inside screen that would be started by cron each time my computer boots. In theory that was true, but in practice the lack of documentation of various peculiarities cost me a few hours of digging and asking around before I had a properly working solution. In this post I will document my solution.
Right away I knew that I wanted to be able to easily attach to the bittorrent screen session at any time, so I used an easy to remember name for it:
screen -s torrent
I also knew that for screen to work with cron it had to start in a “detached” mode. Thankfully, the screen manual told me how to do that:
screen -d m
During my research I came across different people mentioning a short form for all of the above switches:
screen -dmS torrent
Since I like to simplify things I immediately adopted it and unfortunately paid dearly in the end. In fact, this was one of those attractive in theory but poorly executed features that cause other things to fail and waste my time with unhelpful error messages. It took me a few hours to figure out that it was causing screen to keep failing to start from inside cron with a “Must be connected to a terminal.” error.
Once I got over that hurdle I tried the full command without cron:
screen -d -m -S torrent /usr/bin/rtorrent
Everything was good until I noticed that I couldn’t use any rTorrent keyboard commands. I couldn’t even quit it apart from killing it from a separate terminal. According to the rTorrent user guide this was a result of a flow control conflict with screen. Thankfully screen also had a switch -fa just for that:
screen -fa -d -m -S torrent /usr/bin/rtorrent
To be on the safe side I used an absolute path to screen in the cron job:
/usr/bin/screen -fa -d -m -S torrent /usr/bin/rtorrent
Making sure cron starts this each time my computer boots was easy with the @reboot directive so this is exactly what should go in the crontab:
@reboot /usr/bin/screen -fa -d -m -S torrent /usr/bin/rtorrent
After running rTorrent like this for a few days I noticed that it was a bit unstable and would crash sometimes so I came up with a simple Bash script to keep it running:
$ cat ~/bin/myrtorrent
#!/bin/bash
PROGRAM="/usr/bin/rtorrent"
GRACE_DELAY=15
while true;
do
"$PROGRAM"
RETURNED=$?
if [ $RETURNED -ne 0 ]
then
echo "$PROGRAM did not exit cleanly with status code $RETURNED"
echo "pausing for $GRACE_DELAY seconds before restarting $PROGRAM"
sleep $GRACE_DELAY;
else
echo "$PROGRAM exited cleanly. It will not be restarted automatically"
exit 0
fi
done
The final cronjob looks like this now:
@reboot /usr/bin/screen -fa -d -m -S torrent $HOME/bin/myrtorrent
Sadly, the usefullness of this setup is questionable since Bell is throttling DSL resellers’ peer-to-peer traffic.
