HOWTO
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.
HOWTO increase Blender’s memory cache limit for command line renders
by plouj on Jun.08, 2009, under GNU/Linux, HOWTO, hacks
Blender sequencer gives the ability to optimize rendering of repeated frames by keeping the first result in memory cache and re-using it. Depending on the project, it might be necessary to increase this limit beyond the default 32MB. If the limit is surpassed while rendering a single frame, Blender clears the cache before proceeding to the next frame and the re-renders everything from scratch.
Increasing the cache limit is easy to do in the UI:

This setting is stored in the user’s preference file (~/.B.blend on Linux systems) and, therefore, applies to all projects. However, rendering from the command line requires using the -b argument, which explicitly ignores the user’s preference file. Apart from editing and re-compiling the Blender source code, I found only one way to increase the memory cache limit.
The trick is to use a Python script, like below, to change the user preferences before rendering the scene:
import sys import bpy def main(): bpy.config.sequenceMemCacheLimit=4096 if __name__ == '__main__': main()
Add the script to the command line like this:
./bin/blender -b sample-static-text.blend -P render_settings.py -a
Note that the order of arguments matters because first we need to load the scene (with -b), then change settings through Pythons (using the -P option) and finally render the animation (with -a). Also, you need at least version 2.49a of Blender for this to work.
For reference, here’s is the the source file which hardcodes the 32MB limit:
intern/memutil/intern/MEM_CacheLimiterC-Api.cpp:
...
static intptr_t & get_max()
{
static intptr_t m = 32*1024*1024;
return m;
}
...
OpenDNS in Fedora with corporate DHCP and DNS with NetworkManager
by plouj on Apr.20, 2009, under GNU/Linux, HOWTO, hacks
Here is how to configure a Fedora workstation to use OpenDNS nameservers in a network with corporate DNS and DHCP servers without loosing access to their services.
This was done on a Fedora 9 machine with dnsmasq being the local DNS server. It should also work on newer Fedora versions and even other GNU/Linux distributions.
The setup is actually very simple and unobtrusive. It is only necessary to properly configure a local DNS server and then force 127.0.0.1 to be used as the only nameserver instead of the corporate DNS servers.
First you need to configure dnsmasq as follows:
/etc/dnsmasq.conf
# don't use the /etc/resolv.conf file anymore no-resolv # OpenDNS nameservers: server=208.67.222.222 server=208.67.220.220 # Force corporate nameservers for corporate.domain.com lookups # OpenDNS wouldn't be able to answer such queries correctly # adjust to suit your network server=/corporate.domain.com/10.1.1.1 server=/corporate.domain.com/10.1.1.2 # only respond to queries from the local machine listen-address=127.0.0.1 bind-interfaces conf-dir=/etc/dnsmasq.d
Then you need to go into NetworkManager and set 127.0.0.1 as the DNS server to be used:

This will result in the following important settings added to your network scripts:
DNS1=127.0.0.1 PEERDNS=no
I’ve noticed two minor problems with this setup:
- the corporate DNS server names are hardcoded in the configuration. Usually they are determined automatically by the DHCP client.
- restarting the dnsmasq service sometimes shows this error:
dnsdomainname: Host name lookup failure
HOWTO build DXX-Rebirth for Windows with MSYS/MinGW
by plouj on Mar.07, 2009, under HOWTO, games
Introduction
In this post I’ll document the steps I had to take to build DXX-Rebirth (a modernized Descent game engine) for Windows using MSYS and MinGW.
MinGW, MSYS
FromĀ Pantokrator’s blog:
- install MinGW
- choose a lowercase install path: c:\mingw
- choose to download and install current version
- enable g++ (for physfs)
- install MSYS
- install msysDTK
SDL and SDL_mixer
Also fromĀ Pantokrator’s blog:
- download the SDL source
- in the MSYS shell, compile it with
./configure --prefix=/mingw && make && make install
- download the SDL_mixer source and in a MSYS shell, build it with the same command:
./configure --prefix=/mingw && make && make install
PhysicsFS
- Download the physfs 1.1.0 source.
- Compile with the same command again:
./configure --prefix=/mingw && make && make install
SCons and Python
From Globulation2 MinGW instructions:
- install Python 2.6
- install SCons
- add:
PATH=$PATH:/c/Python26:/c/Python26/Scripts
- to the end of /etc/profile in MSYS so that SCons can run from the MSYS shell.
Subversion
- install TortoiseSVN
DXX-Rebirth
- checkout DXX-Rebirth from https://dxx-rebirth.svn.sourceforge.net/svnroot/dxx-rebirth
- change the SConstruct script to call sdl-config as ’sh sdl-config ‘:
...
Flags and stuff for all platforms...
env.ParseConfig('sh sdl-config --cflags')
env.ParseConfig('sh sdl-config --libs')
env.Append(CPPFLAGS = ['-Wall', '-funsigned-char'])
...
- finally, in the MSYS shell, built with:
scons sdlmixer=1
Final Remarks
I had trouble with the latest version of PhysicsFS (1.1.1) because it uses cmake. For some reason it failing to find some prerequisites in MSYS. I also had trouble with version 1.0.1 of PhysicsFS (this is the version the official d1x-rebirth_v0.55.1-win.zip is built with) because the built failed with the following error:
warning: cannot find entry symbol _DllMainCRTStartup@12; defaulting to 00401000 ... undefined reference to WinMain@16
If you notice any problems or mistakes in this post, please mention them in the comments.
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.
