Imaginary Robots

Posts

Playing a Bluray disc on linux

It’s late 2019 and the convenience of streaming is supreme. Netflix is great, but they occasionally remove shows, so I have blu-ray copies of some things. Because of streaming, I actually don’t have a blu-ray player attached to my tv anymore, so it would be great to be able to play them on my computer instead.

Read More

Replacing a Raspberry Pi SD card

Recently my home server (a raspberry pi 3 with attached storage) has been encountering disk errors, and finally gave up on booting entirely. That’s probably because I’ve been running it 24/7 and it had a few unexpected reboots. (I should really add a physical shutdown switch someday).

Read More

An analysis of ssh bruteforce attacks

I’ve been running my home server with fail2ban for quite some time, and it works great! So well that usually, there’s no need to think about the fact that it’s constantly under attack from around the globe (the internet is weird). Occasionally it’s fun to take a peek at the logs and see what sorts of things the ssh bruteforce attackers are trying. It looks like they’ve picked up some new tricks since the last time I checked…

Read More

Exporting Krita layers for use in Spriter

I’m currently working on a game where the characters are hand-painted in Krita (an amazing digital painting tool!). I’m then using Spriter (also awesome!) to put together 2d animations. My original workflow for getting the images from Krita to Spriter is very manual and error-prone, so I’ve put together an automated script to do it for me.

Read More

Sinatra-like Microframeworks Roundup

I’ve been using Perl Dancer for my personal webapps for a few years now, and am incredibly happy with it. I’ve also recently started deploying them with nginx+uwsgi, which (once you get the config right) is a great combination. I’ve recently been looking at what the equivalent would be in other popular languages. Since Dancer is inspired by Sinatra and most other languages have similarly inspired projects, it was a fairly simple list to put together.

Read More

Headless Mac Mini Hardware Hack

A few months ago I installed Ubuntu on my old 2009 Mac Mini (and apparently neglected to write about it), which went well except that it would only boot up properly if there was a monitor attached. For something that I’m using as a headless server, that amounts to a giant pain in the butt. We had a power outage last night and the thing once again didn’t boot up, so I finally did something about it.

Read More

Reading RSS in Perl like a DB

My website currently uses RSS feeds as data sources, and I’m trying to replace some custom parsing code with standard CPAN modules. The DBD::AnyData module seems almost perfect, with the exception that I just spent a few hours banging my head on it trying to get it to read RSS properly. Despite trying many different combinations, it kept reading the channel title instead of the item title.

Read More

Fixing (some) photo timestamps in a folder

Having just gotten back from a vacation with 2 different cameras along, I was dismayed to learn that they didn’t agree on the date - a 10h difference! The end result was a strange and disconcerting time-travelling slideshow - something had to be done! I rolled up my sleeves, got ready to write a long and complex perl script to fix the timestamps, and shortly discovered that the solution is a one-liner using exiftool (which does use Perl under the hood).

Read More

Updated Linux graphics benchmark in Ubuntu 12.10

After upgrading my laptop to Ubuntu 12.10, I decided to re-run the glmark2 tool to see if performance changed at all. Unfortunately, I seem to have lost some graphical oomph with the upgrade. My laptop’s new score is 697, using the same fglrx driver as before. Hopefully that will work itself out after a few weeks’ worth of upgrades/bugfix packages.

Read More

Linux Graphics Benchmarking

With the upcoming beta of Steam for Linux, it seems like a good time to do some benchmarking to see how my graphics card stacks up. In the bad old days, the only real way to test graphics performance in linux was to run glxgears or a game like tuxracer. Luckily, there is now an actual benchmarking tool called glmark2. You can install it in Ubuntu with:

Read More

resolving perl_Gthr_key_ptr error

I’m trying to install a new perl module using cpanm, and the install was failing with an error on one of the dependencies (Class::Accessor::Lvalue, specifically). The exact error was:

Read More

Troubleshooting bonjour devices on LAN

Since purchasing a NAS that supports DAAP streaming, I’ve been trying to get it to play to my Airport Express in the living room. I also couldn’t get PulseAudio on my ubuntu laptop to find that device, so I knew something must be wrong. Searching around, I found a quick script based on Net::Bonjour, which would do a scan for advertised devices. Since it was aimed at finding a misbehaving printer, I’ve updated it a bit to scan for misbehaving audio devices as well.

Read More

Unlocking the Nexus S from Ubuntu

I’ve had my Nexus S for a while now, and I’ve wanted to root it since I got it. Rooting it will give me full control over my device, which will in turn let me save money and protect my privacy (firewall, anyone?).

Read More

Minecraft in Ubuntu 10.04

Minecraft is a great game, and supports a linux client. Unfortunately, it doesn’t actually ship with any sort of launcher script, just a .jar file. Since getting java to run anything is a pain, here’s my launcher script:

Read More

Checklist for Scaling a Web Application

After reading Todd Hoff’s list of scaling lessons learned, I decided to put together my own list of scaling tricks. These were all learned the hard way as well, and will scale you up to thousands of concurrent users. It’s worth noting that many of these don’t cost anything beyond programmer-time, and take less time than ordering/waiting for more hardware. You may still need to throw more hardware at the problem eventually, but these will make sure you’re effectively using the hardware you have.

Read More

Dancer in Shared Hosting

The current(edit: not anymore) version of my website runs on a lightweight perl framework called Dancer. It’s easy to learn and avoids the massive weight of Catalyst, making it ideal for use in shared hosting (paying to get a VM just so you can install thousands of perl modules is not cool).

Read More

Broadcom wireless Network in Kubuntu Lucid

When I set up Kubuntu Lucid on my new laptop a month ago, I promised I would document what was needed to get the broadcom wireless driver working. As it turns out, that was incredibly simple so I never got around to it. However, I just had an issue with my laptop losing wireless after a crash, and I wasted time fiddling because I couldn’t remember what I’d actually set up.

Read More

Fixing Wireless After Crash in Lucid

In Ubuntu Lucid, there is apparently an infrequent problem with NetworkManager not coming back properly when waking up a laptop from sleep/hibernate. Even though it seemed like the wireless driver was somehow no longer working, it was actually due to an inconsistent state being saved/restored. No amount of stopping/restarting services or reloading modules helped, since the config claimed to be working as expected.

Read More

libstdc++5 in ubuntu Lucid

Apparently ubuntu removed the rather-old libstdc++5 library in Karmic Koala, and it’s still missing in Lucid Lynx. This leads to some 32-bit programs throwing errors like this:

Read More

Ubuntu Lucid Dual-boot Error

I just set up dual-boot on my laptop with Windows 7 and Ubuntu Lucid Lynx (10.04 beta1). It worked great (the new ubuntu installer is awesome) up until I rebooted into windows. Technically that worked well too, until I rebooted again and got the error:

Read More

“Grant all” in Postgres

The security model in postgres is very granular, and is locked down by default. this is great for production, but is kind of a pain as a developer working locally. Coming from MySQL, it’s natural to try “GRANT ALL ON * TO some_user;” for development. Unfortunately, that just doesn’t work. From a fair bit of googling, the general advice is “just write a script to do that”, which is very unhelpful (You’re trying to write a DB app, not shell scripts).

Read More

Website Aggregation without a DB

Laziness is the prime virtue of a good programmer (along with being a polyglot, knowing the ins and outs of their editor, and knowing how to google APIs), but it is often forgotten when working on a personal project. My website has been no exception - I’ve actually spent far too much time writing my own session/users/form/template systems over the years.

Read More

GnuPG in mutt

As part of my efforts to contribute to ubuntu, I set up a new GPG key a few weeks ago. I set it up in kmail on my laptop, which works well, but now I need to read the same messages from mutt on my server. It’s not quite so simple when working without the ubuntu safety net, but it’s still not all that bad.

Read More

Zero-Padding a value in T-SQL

I keep running into limitations in T-SQL as used in MS SQL Server. Apparently part of MySQL’s popularity is that the have added useful extensions to the language that actually solve common problems. (Okay, that was a bit too sarcastic. Still though)

Read More

Using GDB with KDevelop 3

To get proper debugging working in KDevelop with gdb as a backend, you have to recompile your project with gdb information. The trick is figuring out where/how to do this, especially in an automake-based project.

Read More

Remounting CIFS Shares on Suspend/Resume

I recently set up a mac mini as a media center and file server. This works great, and I was able to easily share certain folders over the network to windows and linux. The only problem is that the samba shares become inaccessible whenever I suspend/resume my laptop.

Read More

Mounting cifs Shares in Ubuntu

As previously mentioned, I’ve got a mac mini set up as a fileserver. That’s not very useful if I can’t easily get at the files from my linux machine. While Kubuntu fully supports browsing samba shares via smb:/machinename , that doesn’t work with most linux apps.

Read More

SQL to Alter Every Third Row

This was an interesting problem posed to me by a friend. How does one go about altering every third row in a table? As an entirely contrived example, assume the table has exactly 2 columns, name and value, of types varchar(255) and int respectively. Assume that the rows are named like so, probably due to automatic entry or the involvement of a MSCE. Our table might look like this:

Read More

Selecting Overlapping Ranges in SQL

It comes up occasionally that you are storing some events in a DB with some duration, and you want to find all of those events that overlap a given date range. (At work, I needed to find out who was on vacation during a given period; it comes up more often than you’d think). It turns out that it’s a fairly simple SQL query to accomplish this. First, assume your DB table looks like:

Read More