Note to myself: it is possible to change the partition type of a already formatted (and used) partition. For example, if you have already formatted the partition with NTFS, but accidentally had created it with partition type 0x83 (Linux), so Windows can’t read it, since it expects 0x07 (HPFS/NTFS). On Linux, you can use sfdisk for that purpose:
# Be root dd if=/dev/sdb of=sdb-bootsector count=1 # backup boot sector sfdisk -d /dev/sdb | sed -e 's/Id=83/Id=07/' > /tmp/sdb.txt sfdisk /dev/sdb < /tmp/sdb.txt
(fill in the right values for your case)
Of course, good old fdisk works also, use the t command.
[ Update, 2013-10: This post post is not up to date anymore. On newer Debians (since 7.0/wheezy) and Ubuntus (at least since 12.04, Precise Pangolin), you should be able to install zsnes out of the box: sudo apt-get install zsnes:i386. For details see the MultiArch documentation for Debian and Ubuntu. ]
Before I had bought my current hardware, I was working on a 32-bit-based system, and I really appreciated ZSNES as an SNES emulator. But unfortunately, my new hardware was an AMD64 system, and there is currently no ZSNES package for 64-bit Ubuntu or Debian 😦 So I decided to google a bit about the issue, but it took me until now (a year later) to get ZSNES finally working on my machine. The problem is, if you build ZSNES on a 64-bit machine, all the application does is segfault at start, and if you try to compile for 32-bit systems, you get errors about missing 32-bit libs (in particular, configure does not find a suitable libsdl). Instead, if you just take the binary which was compiled on a 32-bit system, and install ia32-libs everything seems to work—at least I was able to play a few levels of Super Mario World succesfully 🙂
So here was my idea: take the 32-bit package from the Ubuntu repository, and just change the Architecture control field, and by this fool dpkg 😛 And as it turned out, this idea worked great. You can get the Debian package here if you want, it should work for Ubuntu Karmic and Lucid, as well as for Debian testing (but I only tested it on Lucid, so there is no warranty here—but I’m happy to hear if it works :)):
- SHA1: 716bbd37267b477ef02961a7727212619309b83f
- MD5: 452ea5230ad17df1dee649ab4cc6c8c0
For the curious people reading here, here is what I actually did:
- wget http://archive.ubuntu.com/ubuntu/pool/universe/z/zsnes/zsnes_1.510-2.2ubuntu3_i386.deb
- ar x zsnes_1.510-2.2ubuntu3_i386.deb
- tar xzf data.tar.gz
- Edited usr/share/applications/zsnes.desktop and added -ad sdl to the Exec: field, otherwise it would just segfault on the first run:
Exec=zsnes -ad sdl
- Edited usr/share/doc/zsnes/changelog.Debian.gz and added a new changelog entry for the version
- tar xzf control.tar.gz
- Edited the control file, changed the Version: and Architecture: field to amd64, added the ia32-libs dependency, and set myself as maintainer:
Package: zsnes Version: 1.510-2.2ubuntu3~ppa1 Architecture: amd64 Maintainer: Roland Hieber <firstname.lastname@example.org> Installed-Size: 4160 Depends: ia32-libs, libao2 (>= 0.8.8), libc6 (>= 2.4), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libpng12-0 (>= 1.2.13-4), libsdl1.2debian (>= 1.2.10-1), libstdc++6 (>= 4.1.1), zlib1g (>= 1:184.108.40.206) [...]
- Changed the md5sums file for the right values for usr/share/applications/zsnes.desktop and usr/share/doc/zsnes/changelog.Debian.gz (I used the md5sum command and copy-pasted it)
- tar czf control.tar.gz control md5sums postrm postinst
- tar czf data.tar.gz usr/
- ar r zsnes_1.510-2.2ubuntu3~ppa1_amd64.deb debian-binary control.tar.gz data.tar.gz
I’m afraid that I can’t put the package to PPA, Launchpad only accepts source packages for uploads, and builds the binary packages itself, both for i386 and AMD64. This approach can not be used here, since we needed the i386 binary for AMD64.
I wanted to restart my IRC bot on reboot, but I also wanted to have control over it and see its log output, so I wanted to start it inside a screen session. This is nearly trivial,
screen -dmS yoursessionname yourcommand is your friend, and you can later on reattach using
screen -r yoursessionname.
But what if I want to start multiple commands, each in its own screen window? My first solution used
screen -dmS followed by something like
screen -r sessionname -X screen; screen -r sessionname -X next; screen -r sessionname -X title "my window title"; screen -r sessionname -X exec "my command line", but it seems that the
next command fails in this context, and I ended up with all the mess in one single window.
My next approach (okay, it took me half an hour of reading the manual until here ;-)) was more succesful: I created a session command file which contained screen commands like this:
screen select 1 title "my window title" exec mycommand arguments ...
And, voilà, I could paste the single command line into my crontab:
screen -dmS sessionname && screen -r sessionname -X source sessioncommandfile
I was bored today and started to play around with this Windows Mobile Messaging application (I think it’s called Outlook Mobile or sort of thing), and I found out that I was not able to connect to my IMAP mailbox on my root server, though it worked with my Freemail account. So I wanted to see what makes Outlook Mobile bother about my IMAP server.
If you are familiar with Linux (which I suppose you are ;-)), you certainly know netcat. With this little tool, you can talk directly to servers on a byte-oriented basis, and this can be very useful if you have to debug programs which use character-oriented protocols like IMAP, SMTP, IRC and so on.
But I’ve realised that I can not only use netcat to talk to a server myself, but even to build a transparent proxy server that displays all the data that comes over it. After a while — okay, it was about 2 hours — I got the following nice command:
$ mkfifo pipe
$ tty=`tty`; netcat -l 1234 < pipe | tee $tty | netcat myserver.com 143 | tee pipe
I could now set up Outlook Mobile to talk to port 1234 on my home computer and the bytes went straight to my console and also to port 143 (the IMAP port) on my server.
The first direction was straightforward: the first netcat process listens to the local port and pipes its output first to the console (using tee) and then to a second netcat instance that does the communication with the remote server. Now, the commands from the server have to get back to the client, so I created a named pipe using mkfifo (of course, your filesystem has to support it, so you better not do this on FAT) and used this as the input to the first netcat process that sends it back to the original client.
Of course, I could have used Wireshark, but I hate that it does not allow to copy&paste the contents of a packet so I have only the bytes of the protocol that I need — which can be quite useful if you want to reuse parts of the content, especially in character-oriented protocols. Also, the filter settings in Wireshark can be annoying, there is no simple way to only have packets from one network connection (or I haven’t found it yet).
So, finally I found out that is has something to do with the IMAP capabilities that Outlook Mobile bothers about. I suppose I will write something about it if I have traced the problem back.
Update: Note: You can also rewrite the server and/or client messages using sed, but be sure to use unbuffered output with -u like that: