Archive for the 'Computers' Category

Minecraft: TNT Cannons

Sunday, September 9th, 2012

In short, for those that didn’t know: It’s possible to build cannons in Minecraft, using TNT as charge, as well as payload. The trick is to detonate the charge TNT earlier, and place the payload in a position where it will be driven away by the explosion. And of course, unless you want your cannon to explode, you’ll need to place the charge into something inert, water will work nicely. Just search for “minecraft cannon” on youtube to see examples.

So these are some cannon designs I did for minecraft. I don’t claim the original idea for them, I just implemented, tried and tested. The reason I did this, was that I needed rather small cannons which wouldn’t look too alien on emplacing them onto the ramparts of a minecraft fortress.

Of course, they all come with schematics for mcedit (another one, not the mcedit from Midnight Commander).

Basic Cannons

These all are very basic. Payload is activated by some delay achieved with repeaters. However, since they’re rather simple, and space was scarce, there isn’t actually enough delay, so these don’t work against targets below the plane of the gun. The payload will just explode in mid-air in that case.

Simple cannon, 5x3x3 blocks

Cannon5x3x3.schematic

Simple cannon, 6x3x3 blocks

Cannon6x3x3.schematic

Simple cannon, 7x3x3 blocks

Cannon7x3x3.schematic

Diagonal cannon, 8x7x3 blocks

Yep, that one shoots diagonally.
DiagonalCannon8x7x3.schematic

Basic Aimable Cannon

The idea heere is to work with two stacks of charges, and to aim by not filling one stack completely. I also tried to make some non-diagonal ones, but I haven’t found a reliable design yet.

Aimable Diagonal Cannon, 8x7x3

AimableDiagonalCannon8x7x3.schematic

Better Cannons

These here are the ones I actually use. They contain enough repeaters to shoot just about anywhere, the main constraint in range seems to be minecraft itself, or rather the new client-server model of Minecraft 1.3.

All of them use obsidian for barrels, and sand stone for the carriage (or whatever you want to call that). Actually, if it explodes on you, only the half-slab in front, plus some redstone will have to be replaced. And if you bury them 2 blocks, the flood shouldn’t damage the repeaters.

Cannon Mk1, 8x5x6 blocks

My first design for a cannon for use in fortresses. It’s supposed to be buried 2 blocks deep. It’s quite slick, but due to it using only 9 repeaters, maximum range is slightly limited to what is possible.
CannonMk1-8x5x6.schematic

Cannon Mk2, 8x5x6 blocks

This one has the circuits slightly altered, making it able to delay a tiny bit longer with its 10 repeaters. An in-between version had a totally altered layout with 12 repeaters, which turned out to beb totally useless, since 10 is the useable maximum (otherwise you get squibs).
CannonMk2-8x5x6.schematic

Carronade, 6x5x6 blocks

This one is actually a totally redesigned Mk1. It’s much shorter, but since it still uses 2 layers of TNT, it still packs a pretty punch. It’s not as slick as the Cannon, since a few sacrifices had to be made to fit all 9 repeaters.
Carronade6x5x6.schematic

Arrow Gun


Here as well, a tight footprint and a “look” of a gun (when buried two blocks deep) was aspired. Uses a pulser, you turn it on, it shoots arrows, until it runs out or you turn it off.
ArrowGun3x3x3.schematic

Debian Multi-Arch woes

Sunday, July 15th, 2012

Since a few months, Debian is going Multiarch.

So I thought I give it a try. I compiled a 64bit-kernel on my 32bit computer:
make menuconfig ARCH=x86_64; make ARCH=x86_64
Which works nicely. You only need to take care that if you ever need to compile an i386-kernel on the same machine, you will need to specify ARCH=x86 for that one in the future (after you’ve booted your system to use the 64bit kernel).

From there on I installed a new Debian, debootstrap --arch=amd64 sid /mnt, mounted a few necessary filesystems into it, and chrooted into the new 64bit system:

mount -o bind /proc/ /mnt/proc/
mount -o bind /sys/ /mnt/sys/
mount -o bind /dev/ /mnt/dev/
mount -o bind /boot/ /mnt/boot/
chroot /mnt /bin/bash

Now comes the usual installation, packages, configfiles, installing grub, etc.

A few hours later I had a complete system, with my usual 6000 packages installed…

Upon booting the new system, I stumbled upon some few small problems, like libasound2-plugin-equal not being installed (and after that, complaining about a wrong binary format of .alsaequal.bin), No big problems there, until I turned on Multi-Arch:
dpkg --add-architecture i386
and started to try to install some i386 programs. Most work, at least when you’ve got all those dozens of i386 dependencies right.

But then came wine. Turns out, wine needs wine1.5-amd64 and wine1.5-i386 both, and the latter, wine1.5-i386 needs to be built on an i386. I already had that; but I still needed to recompile it without opencl, since that one refused to be installed as a 32bit-version on amd64 (well, it wants to deinstall the 64bit version).

After having installed all the runtime dependencies for the android-SDK, AVG antivirus and, most of all, wine1.5-i386, I ended up with these i386 packages installed:

gcc-4.7-base:i386 libasound2:i386 libasyncns0:i386 libattr1:i386 libc6:i386 libcaca0:i386 libcap2:i386 libdb5.1:i386 libdbus-1-3:i386 libdirectfb-1.2-9:i386 libdrm-intel1:i386 libdrm-nouveau1a:i386 libdrm-radeon1:i386 libdrm2:i386 libexif12:i386 libexpat1:i386 libffi5:i386 libflac8:i386 libfontconfig1:i386 libfreetype6:i386 libgcc1:i386 libgcrypt11:i386 libgd2-xpm:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libglapi-mesa:i386 libglib2.0-0:i386 libglu1-mesa:i386 libgnutls26:i386 libgpg-error0:i386 libgphoto2-2:i386 libgphoto2-port0:i386 libgpm2:i386 libgstreamer-plugins-base0.10-0:i386 libgstreamer0.10-0:i386 libice6:i386 libjpeg8:i386 libjson0:i386 liblcms1:i386 libldap-2.4-2:i386 libltdl7:i386 liblzma5:i386 libmpg123-0:i386 libncurses5:i386 libncursesw5:i386 libogg0:i386 libopenal1:i386 liborc-0.4-0:i386 libp11-kit0:i386 libpciaccess0:i386 libpcre3:i386 libpng12-0:i386 libpulse0:i386 libsasl2-2:i386 libsdl1.2debian:i386 libselinux1:i386 libslang2:i386 libsm6:i386 libsndfile1:i386 libssl1.0.0:i386 libstdc++6:i386 libtasn1-3:i386 libtinfo5:i386 libts-0.0-0:i386 libusb-0.1-4:i386 libuuid1:i386 libvorbis0a:i386 libvorbisenc2:i386 libwrap0:i386 libx11-6:i386 libx11-xcb1:i386 libxau6:i386 libxcb-glx0:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxi6:i386 libxml2:i386 libxpm4:i386 libxtst6:i386 libxxf86vm1:i386 zlib1g:i386

Just don’t dare to install anything i386 with dpkg from a package, without having the dependencies there first. It will want to deinstall half your system first when doing apt-get -f install .

And now comes the really un-funny part. Notice that “mesa” in there? Yes, this means nvidia is not going to be accelerated for 32 bit, which means again just about no 32bit 3D applications will run with any decent speed, if at all. Same for wine as for native apps. The whole nvidia-packages are just not multi-arch capable, and unless you’re feeling to mess up your system with by-hand copied binaries, you just go back to your 32bit-system (with a 64bit kernel) and wait a few month more before trying to switch again.

Minecraft: Châteaux Vufflens

Wednesday, April 18th, 2012

Irgendwie hat sich dieses spätmittelalterliche Ding in Backstein einfach aufgedrängt. Es wollte in Minecraft realisiert werden. Warum ich 18-24 Stunden dafür verwendet habe weis ich immer noch nicht. Es wollte es eben.

Dokumentation von 1881

Aber dafür bekommt nun die Welt nicht bloss ein Minecraft-Schema, sondern auch gleich die Dokumentation und Pläne von Vufflens, aus den “Mittheilungen der Antiquarischen Gesellschaft in Zürich” von 1881, komplett digitalisiert, und die Texte durchs OCR gejagt. Die sind Gemeinfrei (“Public Domain”).

Minecraft Level

Ich habe versucht mich möglichst genau an die Pläne, sowie diverse Bilder aus dem Internet, inklusive Google StreetView zu halten. Naturgemäss ist bei 1×1-Meter-Blöcken nicht alles genau einzuhalten. Die Raumaufteilung stimmt, die Proportionen ungefähr (tatsächlich ist der Donjon zu hoch; eine Notwendigkeit damit der Vorbau genügend Stockwerke bekommen konnte) gewisse moderne Dinge wie die Terrasse vor dem Palas habe ich weggelassen. Die Lizenz hier ist die OPL 1.0 (was in etwa dasselbe wie CC-by-sa ist).

Enjoy!

Natives IPv6 via VDSL

Tuesday, April 17th, 2012

Mit gewissen schweizer ISPs, namentlich AtrilA oder iWay ist es möglich IPv6 mit ihren DSL-Angeboten zu bekommen. Das hier ist die Konfiguration für eine Firewall mit Debian/Squeeze. Nebst der IP der firewall selber (die via PPPoE über das Modem, welches als Bridge konfiguriert ist daherkommt), ist hier je ein ganzes IPv4 und ein IPv6-Netz geroutet. eth0 ist das interface richtung Modem (welches auch per default auf 192.168.1.1 erreichbar ist). eth1 ist das interne interface. dsl-provider richtet das interface ppp0 ein, und dass ist gleichzeitig der name der PPPoE configdatei unter /etc/ppp/peers

/etc/network/interfaces/ enthält folgendes:

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

auto dsl-provider

iface dsl-provider inet ppp
pre-up /sbin/ifconfig eth0 up
provider dsl-provider
up ip -6 route add default dev ppp0

auto eth1

iface eth1 inet static
address xxx.xxx.xxx.1
netmask 255.255.255.240
broadcast xxx.xxx.xxx.15

iface eth1 inet6 static
address 2xxx:xxxx:xxxx::1
netmask 48

Die configdatei /etc/ppp/peers/dsl-provider habe ich mit pppoeconf generiert; sie enhthält folgendes:

noipdefault
usepeerdns
+ipv6
defaultroute
hide-password
lcp-echo-interval 20
lcp-echo-failure 3
connect /bin/true
noauth
persist
mtu 1492
noaccomp
default-asyncmap
plugin rp-pppoe.so eth0
user “myusername@domain.ch”

Die direktive +ipv6 musste ich von Hand einfügen.

Auch notwendig: IPv6-forwarding. Ich habe das in /etc/sysctl.d/ipv6_forwarding.conf reingeworfen:

net.ipv6.conf.all.forwarding = 1

Was hier noch fehlt sind natürlich die Firewall-Regeln, für IPv4 und für IPv6.

Die Client-Konfiguration ist straightforward; entweder statisch via /etc/network/interfaces oder sonst dynamisch auf dem server via radvd.

Weiterführendes: Martin Kraffts IPv6 with Debian-Seite.

eeePC: Making it work

Monday, February 13th, 2012

I’ve already written about Debian GNU/Linux on the Asus EeePC and how to Upgrade Debian on the eeePC to Squeeze, but this weekend, the power supply of my workstation died, and I had to work exclusively on the eeePC. These are the lessons.

My eeePC 701 is heavily space-constrained, I’ve partitioned it with 2.5GB for system, and 1.5GB for /home. Apart from performance, space was the major consideration.

No Gnome, no KDE

I decided earlier to only not to use gnome, and only to install KDE. Both come with about the same footprint in packages and libraries. As it turns out, KDE wasn’t a good idea either. With Akonadi and Nepomuk it tried to fill up my /home, and it generally proved to be a ressource-hog. I decided to get rid of it, and to replace all remaining KDE-software, mainly Kmail, Kaddressbook, Kopete, Kword and Kspread.

Dead Firefox

If you haven’t noticed, the firefox/iceweasel still delivered with Debian “squeeze”, 3.5.16, is dead. Dead like in “there are no more extensions which can be installed”. Like AdBlock Plus. You’ll need a Mozilla Backport, thankfully provied by the Debian Mozilla Team.

Embedded Debian

Use it. It saves about 25% to 30% of harddisk-space, solely by not installing documentation and translations, and by sometimes not having as many dependencies as the normal debian packages. The packages are binary-compatible with the normal debian-packages, so all you have to do is to add their repositories to your system:


deb http://www.emdebian.org/grip/ squeeze main dev debug java doc
deb-src http://www.emdebian.org/grip/ squeeze main dev debug java doc

As said, they integrate seamlessly, but due to their “em1” suffixed to the package-version, they will get preference (and some 2/3 of all packages will automatically be upgraded). You could control that with apt-pinning, of course, but I saw no need yet.

Big Screen

Since I had screen, mouse and keyboard available, I connected those to the eeePC. The monitor wouldn’t work at first, until I deleted /etc/X11/xorg.conf as the easiest thing to do. Also, it was unusable at 1920×1080 at 60Hz, so I calculated some modelines and made a small script for xrandr, to use 59.8Hz.


xrandr --newmode 1920x1080_59.80 172.50 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode VGA1 1920x1080_59.80
xrandr --output VGA1 --mode 1920x1080_59.80

Applications

Now the applications I installed.

  • Desktop Xfce4
  • Mail Claws. Small and fast, and does a lot
  • Jabber Psi. I also have mcabber, but this is more comfortable.
  • Word-Processor abiword. Which I only did because with the emdebian-packages, it didn’t pull in the whole of gnome
  • Spreadsheet gnumeric. Same as with abiword
  • E-Reader fbreader
  • PDF-Reader xpdf
  • Movie-Player smplayer
  • Editor tea. Apart from mcedit which does all my editing needs on the console, you sometimes need a graphical one.
  • Terminal xfterm and rxvt-unicode. These took a lot of time to decide on. The first one is pretty basic, well-integrated into xfce and has tabs. The latter supports font-resizing, does utf-8, and generally does everything right that aterm, wterm, Eterm and mlterm do wrong.

Display EPUB metadata and rename EPUB files accordingly

Wednesday, January 25th, 2012

I’ve been programming. First a fast replacement for displaying metadata of an EPUB-file:

$ epub-meta -v 1632.epub File: 1632.epub
Title: 1632
Author: aut: Eric Flint(Flint, Eric )
ID: ISBN (Unspecified:0-671-31972-8)
ID: uuid (uuid_id:b1d2b16c-f68d-4a80-9d02-f6fcac36e1f3)
Subject: Science Fiction
Publisher: Baen Publishing Enterprises
Date: Unspecified: 2000-02-07T05:00:00+00:00
Lang: en
Contrib: bkp: calibre (0.6.51) [http://calibre.kovidgoyal.net](calibre (0.6.51) [http://calibre.kovidgoyal.net])
Meta: calibre:series_index: 1.0
Meta: calibre:timestamp: 2010-05-07T16:59:51.299000+00:00
Meta: cover: 0671578499_Cover
Meta: calibre:series: Ring of Fire
Meta: calibre:user_categories: {}
Meta: calibre:author_link_map: {}

It has commandline-switches to selectively choose which metadata should be displayed. And it does it very fast, 3ms on my system, as opposed to 670ms ebook-meta from Calibre needs. However, it can only display the metadata, not change it. For changing metadata, you still need ebook-meta.

Having the ability to display metadata fast, made it possible to rename EPUB-files. Initially, I had the idea to do that in C too, but working with strings is actually quite tedious in C, so I decided on perl. So there’s now also a program called epub-rename, which renames EPUB-files according to it’s metadata in the format Author - Series SeriesIndex - Title. Moreover, it also has, trough ebook-meta, the ability to fix certain issues in metadata-tags. Namely change inverted Title/Author tags, fix Author-Tags which are in the wrong(!) Last, First-Format, and some more.

Well, here’s the “–help”
$ epub-rename --help
Usage: [options] [directory ...]

Options:
-c|--compat
-f|--fix
-h|--help
-t|--title
-r|--rename
-x|--exchange
-v|--verbose

Options:
-c|--compat
Use ebook-meta from calibre instead of epub-meta. Much slower.

-t|--title
Fix title. This means the tag gets sanitized, as it would if
destined for a filename, and then written back to the metadata.
Uses ebook-meta.

-f|--fix
Fix all tags: author, title, and in some cases date. Uses
ebook-meta and touches every file, even those that don't need
fixing. Slow.

-h|--help
Print a brief help message and exit.

-r|--rename
rename files to the pattern "Author - Series SeriesIndex -
Title"

-x|--exchange
changes title for author-tag and vice versa. For all those files
that have the author in the title-field and the title in the
author- field. Uses ebook-meta, thus is slow.

-v|--verbose
Show how all files would be renamed, not just those really
renamed.

And here’s the program itself: epub-meta-0.2.tar.gz. MIT-Licensed. Enjoy.

If you don’t like the spaces, punctuation and UTF-8-characters in the output filenames, I’d recommend another program of mine: bicapitalize.

How to Enter EPUB Metadata

Friday, January 20th, 2012

If you have a certain library of E-Books from different sources (e.g. Baen, Gutenberg, Archive.org, Google Books) you will notice a disparaging plethora of different styles of annotating EPUB-files, sometimes blatantly wrong and in violation of the EPUB Standard itself.

So this is a Howto on how to enter these metadata correctly. I’ll mostly cover the program “ebook-meta” (part of Calibre) which is available on about every platform.

Encoding

EPUB uses UTF-8, and UTF-8 only. Still, if you don’t use things like left-and-right quotes and backquotes, you’ll make sure your tags don’t get messed up. Ideally, only use the single quote “‘”.

Vocabulary

Try to be consistent in the vocabulary for tags (genres, categories). Sadly, no vocabularies are specified by the standards right now.

Tags

  • Title: This will contain the Title as it’s read. Don’t put in the author (yes, seen that). Don’t anticipate sorting by naming it “Title, The”, this is the task of the library program which sould do this. Don’t enter Series and Series Index. Don’t enter the author here.
  • Title sort: You don’t need to enter that; at least ebook-meta usually sets this correctly.
  • Author(s): Enter the author as named. Don’t enter the title here (also seen..), and don’t enter things like series or title after the author’s name. Don’t anticipate sorting by naming it “Name, First Name”. Enter it in the form “First Middle Last”. If the authors name is usually used with initials, use these. Don’t enter “John Ronald Reuel Tolkien”, but “J. R. R. Tolkien”. After an initial, enter a dot and a space. If there are several authors, enter all of them, when using “ebook-meta” separate them with “&”.
  • Author sort: You don’t need to enter that; at least ebook-meta usually sets this correctly.
  • Publisher: This is the original publisher. If you’re preparing an out-of-copyright e-book, don’t enter yourself. Also, don’t anticipate sorting but enter it as given.
  • Languages: At least one language must be set, you can set several if the book is multi-lingual. The language-code is the 2-letter iso-code. Apparently it ignores localized ones such as “en-gb”.
  • Published: This is the original publishing date. Not the date you’re preparing the e-book!
  • Rights: Enter the year and copyright holder, if applicable, and a license if necessary. Like this: “Copyright 1954 by J. R. R. Tolkien” or “Copyright 2012 by Peter Keel, License CC-By-2.5” or “Public Domain” if the work is not protected by copyright anymore.
  • Identifiers: Here go ISBN or ISSN (for magazines) or UUID. You can put in as many as ou like. “ebook-meta” allows only to set the ISBN and a BookID specifically.
  • Comments: This is actually the “Description”-tag, and it’s supposed to hold the blurb which would otherwise go onto the flap or the back of a physical book. And it should not contain HTML-tags. Also, don’t make this too long.
  • Series: This is a Calibre-specific tag, however it’s honored in many e-book-readers, so you really want to use this. Enter the series as spelled. Don’t take sorting into account. Don’t enter any series number.
  • Series Index: Also Calibre-specific, but goes with support for the “Series”-tag. Enter a number here, corresponding to the number in the series.
  • Tags: This one is really the “Subject”-tag. It contains as many tags as you wish on what the book is about. Enter the genre here as well. Enter tags separated by comma. Do NOT enter a blurb here.
  • Category: This is probably the “Type” tag but support seems to be rather limited. in any way, the genre does NOT go into that, but rather things like “textbook” or “novel”.

Android on LG GW620 – OpenEve

Friday, May 20th, 2011

After having tried OpenEtna 6.3-rc7 (which is essentially Cyanogen-mod 6.X (Froyo) modified for the LG Eve) and constantly having problems because of some weird Bugs I decided to install some other version. Besides, OpenEtna appears rather dormant.

Luckily I found OpenEve, which is a patched Cynogen-mod 7.x, which in turn is a patched Android 2.3.4 (Gingerbread), snapshot 20110514a. Which happens to work nicely.

Initially I had some problems with the keyboard special keys not working correctly, but I managed to find a workaround; and the maintainer is actually fixing bugs and commenting in the bugtracker, as opposed to the OpenEtna-project which seems to have died.

The keyboard-issues might even stem from my earlier OpenEtna-settings, because I did not flush them. But all the other settings posed no problems, so it’s kinda nice to not have to restore backups.

Most important binaries are there, like a bash, busybox and dropbear (altough I still have to find out how to turn on dropbear). Midnight Commander is missing and I still didn’t manage to compile it, but I found a binary which somehow works, and can be disciplined with some tinkering (something which probably gets its own blog-post).

Sadly OpenEve’s development pace isn’t exactly fast, but you get new releases every few months.

Unpack, Change and Repack Android Apps

Sunday, February 27th, 2011

Some time ago, I read Lock down your Android APK permissions by benn from Intrepidus Group.

I decided to automate the whole procedure, at least the unpacking, signing and repacking. Each app has to have it’s own key (lest the apps signed with the same key can access each others ressources!) which was the thing that most needed automation.

So I wrote some shell-scripts. The scripts are not only useful for changing the permissions of an app from any source (unpack, edit AndroidManifest.xml, resign), but also for android developers themselves. it’s much easier to manage keys and sign different apps with them.

So here they are:

  • android-unpack Stupid script to decode .apk-files, all of those in a directory, actually.
  • android-resign Script to pack .apk-files, and sign them. Each project with it’s own key.

Of course, if you re-sign foreign apps with your own key, they won’t be the same ones as on the Android Market, and thus not automatically upgradeable and will not use the same configuration.

Android, Updates and Backups

Sunday, February 27th, 2011

I’ve got a n LG GW620. I chose this because it a) runs android and not some more stupid operating system b) it has a keyboard and c) it’s supported by an open project, namely OpenEtna, which among other things provides an updated operating system with a bash and a root-shell.

Now, I’m not the guy who stores anything on “The Cloud”. If there is anything out there that I deliberately store data on, it’s my own server, my own cloud.

So before upgrading I naturally decided to do a Backup, and of course I decided to use the software which advertised to Backup Everything. As it turned out, it doesn’t.

First off, the upgrade didn’t go very smoothly. After not having wiped cache and userdata, the Phone refused to continue at the “Welcome to GW620” screen. After wiping and flashing again, this worked.

Of course, all the settings were lost, and all the apps. So clearly, just put the backup-software onto the phone, and restore them. Turns out, the settings for going to the Android Market are lost as well, AND the friggin idiots only let you download the App from the Market! Thank you very much, you stupid twits. So make a backup of the apk-file onto your SD-card or harddisk before relying on it…

After having found some old version of “Backup Everything” which was thankfully downloadable with something other than the phone itself, I was able to restore “something” or “a bit”. SMS-archive, caller logs, access points, all there. Applications, Contacts, WLAN-credentials missing. It tried to reinstall some applications, but that mostly failed. At least it has a list of applications which you then can click on individually which opens a search on the Marketplace and install them.

The contacts I had to restore from an adressbook vcf from my harddisk (kaddressbook can export the addresses you choose to a vcf), but doubtless, some are missing. I only realized afterward that the android provides an “export contacts to SD-card” option by itself. But then, I didn’t expect “Backup Everything” not to backup everything.

I’m pretty sure some configuration-options of android itself, and also of applications are still wrong or missing. We’ll see.