Yes, head this way to participate. You know you want it 🙂
Author Archives: dirk
Automated WordPress Backup on Uberspace
This is how I backup this site, hosted on Uberspace.
Note: All scripts should be made executable: chmod +x script
I created the following file ~/bin/backup_wordpress.sh
:
#!/bin/bash
NOW=$(date +"%Y-%m-%d-%H%M")
FILE="blog.dirkz.com.$NOW.tar"
BACKUP_DIR="/home/uberspace_/backups"
WWW_DIR="/var/www/virtual/uberspace_/blog.dirkz.com/"
DB_USER="user"
DB_PASS="pass"
DB_NAME="db_name"
DB_FILE="blog_dirkz_com.$NOW.sql"
WWW_TRANSFORM='s,^var/www/virtual/user/blog.dirkz.com,www,'
DB_TRANSFORM='s,^home/user/backups,database,'
tar -cvf $BACKUP_DIR/$FILE --transform $WWW_TRANSFORM $WWW_DIR
mysqldump -u$DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/$DB_FILE
tar --append --file=$BACKUP_DIR/$FILE --transform $DB_TRANSFORM $BACKUP_DIR/$DB_FILE
rm $BACKUP_DIR/$DB_FILE gzip -9 $BACKUP_DIR/$FILE
Created a cronjob (`crontab -e’) with the following content (daily is sufficient for me):
@daily /home/uberspace_user/bin/backup_wordpress.sh
To fetch those backups I created a tiny local script (~/bin/fetch_uberspace_backups.sh
):
#!/bin/bash
rsync ip@ip.menkar.uberspace.de:backups/* /home/local_user/backup/uberspace_ip
ssh ip@ip.menkar.uberspace.de 'rm backups/*'
Then setup anacron on a local machine (vi /etc/anacrontab
as root):
@daily 10 fetch.uberspace.backups nice run-parts /home/local_user/bin/fetch_uberspace_backups.sh
My local backup folder should now be filling with backups. I also set MAILTO
to my email address, so I get noticed a couple of days (as a reminder to verify everything’s ok). After that I will remove it.
Install VLC via rpmfusion on Fedora 20
These are my notes for installing VLC on Fedora 20, using only rpmfusion free:
gpg --keyserver pgp.mit.edu --recv-keys AE688223 B5F29883
yum localinstall http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
gpg --fingerprint AE688223 B5F29883
yum install -y vlc mozilla-vlc
The RPM Fusion Keys were as follows during my installation:
pub 4096R/AE688223 2013-01-01
Key fingerprint = 0017 DDFE FD13 2929 9D55 B1D3 963A 8848 AE68 8223
uid RPM Fusion free repository for Fedora (20) <rpmfusion-buildsys@lists.rpmfusion.org>
pub 4096R/B5F29883 2013-01-01
Key fingerprint = A84D CF58 46CB 10B6 5C47 6C35 63C0 DE8C B5F2 9883
uid RPM Fusion nonfree repository for Fedora (20) <rpmfusion-buildsys@lists.rpmfusion.org>
If you want to install libdvdcss, you need to add another repo and then install it:
yum localinstall http://dl.atrpms.net/f20-x86_64/atrpms/stable/atrpms-repo-20-7.fc20.x86_64.rpm
yum install libdvdcss
This is the fingerprint I observed:
Importing GPG key 0x66534C2B:
Userid : "ATrpms.net (rpm signing key) <Axel.Thimm@ATrpms.net>"
Fingerprint: 7d6a 4524 1d82 5ec2 fde5 9651 508c e5e6 6653 4c2b
Package : atrpms-repo-20-7.fc20.x86_64 (@/atrpms-repo-20-7.fc20.x86_64)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-atrpms
Switch ALT with CMD on Apple keyboards on Linux with Kernel 3.13
A feature introduced in kernel 3.13 enables you to easily switch alt
and cmd
keys on apple keyboards. The following is for Fedora 20:
Switch alt
and cmd
temporarily (as root). Note that GNOME 3 didn’t seem to realize that during my limited testing, whereas Mate picked it up on the fly:
echo "1" > /sys/module/hid_apple/parameters/swap_opt_cmd
Edit/create /etc/rc.d/rc.local
with the following contents to make this permanent:
#!/bin/sh
echo "1" > /sys/module/hid_apple/parameters/swap_opt_cmd
Make it executable:
chmod 700 /etc/rc.d/rc.local
Building Android SDK on Fedora 20
See Building Android Tools and Fedora Android Setup for reference. Commands like yum have to be sudo’ed or run by root, all other commands should be run by an ordinary user.
Make sure you have about 30-100 Gigs HD space available (depending on on what you build).
Since fedora 20 starts out with kernel 3.11, I updated to 3.13 (probably not necessary, but I really like 3.13). Reboot if you updated your kernel:
yum update
Install android emulator 32 bit packages:
yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686
Install other needed packages:
yum install gcc gcc-c++ gperf flex bison glibc-devel.{x86_64,i686} zlib-devel.{x86_64,i686} ncurses-devel.i686 libsx-devel readline-devel.i686 perl-Switch git gpg schedtool
Make sure you have javac:
yum install java-1.7.0-openjdk-devel.x86_64
Alternatively, you can install all required packages with one command:
yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 \
ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686 gcc gcc-c++ gperf \
flex bison glibc-devel.{x86_64,i686} zlib-devel.{x86_64,i686} ncurses-devel.i686 libsx-devel \
readline-devel.i686 perl-Switch git gpg java-1.7.0-openjdk-devel.x86_64 schedtool
Install repo
:
mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Make sure repo
works (on my freshly installed fedora 20, ~/bin
was already in the path).
Check out sources. repo sync
can take a long time. Another example for -g
would be -g all,-notdefault,-device,-mips,-eclipse,-darwin
to omit builds you probably don’t need. You might also adapt the -b
flag for another android version (e.g. -b android-sdk-4.4.2_r1
), but branches other than master might not support building on Open JDK 7. Also append --config-name
if you want to change your git developer name.
mkdir ~/android
cd ~/android
repo init -u https://android.googlesource.com/platform/manifest -g all,-notdefault
repo sync
Create the cache:
echo "export USE_CCACHE=1" >> ~/.bashrc
export USE_CCACHE=1
prebuilts/misc/linux-x86/ccache/ccache -M 25G
Use JDK 7:
echo "export EXPERIMENTAL_USE_JAVA7=true" >> ~/.bashrc
export EXPERIMENTAL_USE_JAVA7=true
Build (adjust make -jn
for the number of cores / hardware threads in your machine). The code here juse uses the number of available CPUs. According to the Replicant SDK build instructions best results on fast hardware will come with -j9
, -j16
and -j32
:
. build/envsetup.sh
lunch sdk-eng
parallel_tasks=$(echo "$(grep 'processor' /proc/cpuinfo | wc -l ) + 1" | bc)
make -j$parallel_tasks sdk
Some output files are located at:
out/host/linux-x86/sdk/
out/host/linux-x86/bin/
Your SDK zip should be located here: out/host/linux-x86/sdk/android-sdk_eng.<username>_linux-x86.zip
Notes
If you’re only interested in adb
and fastboot
(e.g., for bootstrapping a cyanogen mod device build), then just make those:
make fastboot adb
On my machine the adb and fastboot didn’t work very well, but the ones from a Replicant SDK build did.

NetHack 4 on iPhone 4
Hack for iPad is released, based on the original 1.0.3
As requested by readers, this Hack prototype you might have glanced over a year ago on this blog is now cleaned up and got approved by Apple. It’s now available on the app store. It’s based on a BSD version of Hack 1.0.3 published by Andries Brouwer, which in turn is based on Jay Fenlason’s Hack.
Please be aware that this is a very old game (originally published in 1985), lacking many of the refinements of the latest and greatest NetHack 3.4.3.
If that doesn’t deter you from buying it, please make sure to let me know by mail or in the comments of any problems you encounter that are platform-related.
RogueTerm 1.02 released
I just approved 1.02 for app store release, it should go live soon. Among many bug fixes and UI improvements the main aim for this release has been full compatibility with Dungeon Crawl Stone Soup (DCSS).
From the changelog:
- DPad support for DCSS
- Full support for DCSS 0.9.1
- Support for iPad portrait orientation
- Fixed bugs that prevented return-key to work properly
- Can properly use backspace in engrave in NetHack
- Support for several DCSS UTF-8 chars, like trees and water
- Support for port in server name, like crawl.develz.org:345
- More robust error handling
Vanilla NetHack 3.4.3 Binaries (Terminal Port) for OSX Lion
Since I had to test something on a pure TTY vanilla NetHack anyway, and as always it took me a while to figure all the minimal patches out, I decided to upload the result to github. Then I realized that OSX Lion users are no longer able to download the official NetHack Mac binaries due to lack of Rosetta, so made the whole thing into a binary distribution as well.
It’s a single-player dist that you have to extract directly into your home folder, so you’ll get ~/NetHack
as a result. If you want to relocate the installation you have to do so manually (think setting HACKDIR or editing the main script).
Download NetHack 3.4.3 Terminal Port for OSX Lion
Please let me know if you run into any trouble.
Happy hacking!
RogueTerm 1.01 queued for release
RogueTerm 1.01 contains some quick bug fixes, including:
- Deleting servers is permanent
- Adding Meta-Chars to the action bar should now work without crashes
- Clarified that IBMGraphics is currently not supported, use DECGraphics instead. Please contact me if your game/server doesn’t support this (see the built-in Help for details).