Packaging Wakatime CLI for ArchLinux

I’ve decided to give Wakatime a second try. It’s a tool that tracks the time you spend programming on different projects by integrating into your IDE. This works well for typical development work where you open your IDE in the morning and type code in it, do commits with it, and everything else related to the project and Wakatime will track that.

I don’t work like that though, so I had two issues with it last time, both resulting in a lower reported time spent working:

  • I spent most of the day working on different remote servers and it would be a hassle to set it up in the text editor on each of them and it would undoubtedly cause slowdown on the older servers
  • I use the command line tools as my IDE, so the time recorded opening the text editor to make some changes is not representative of the time spent working

This time it’s different because nowadays I virtualise most of the services I work with, using Docker on my local machine, and I’m hoping that using the Wakatime Z Shell integration will give a better record of time spent working on a project.

Installing the Wakatime zsh plugin is as easy downloading the script and sourcing it in your .zshrc file. The only issue is it depends on the Wakatime CLI, which is usually bundled with Wakatime integrations, just not this one. The README file instructs you to get the CLI with sudo pip install wakatime but that leads to a system that’s difficult to maintain: Ideally you’d like to be able to install it from your distribution’s package manager but there’s no official ArchLinux Wakatime package and nobody has written a package script for it in the AUR yet. Luckily it turns out to be pretty easy to do.

The CLI is Python based and available for download on pypi (what pip does when you pip install). There are clear instructions on the ArchLinux wiki on how to make a Python package with the distutils tool that comes with Python, and a prototype Python package script you can use as a starting point.

All I had to do was fill out the fields in the example package: The download URL, version number and md5 hash are found in the pipy page. The licence, website, description and everything else is on the GitHub page. The result looks like this:

# Maintainer: Siôn le Roux <sinisterstuf@gmail.com>
pkgname=wakatime
pkgver=10.1.0
pkgrel=1
pkgdesc="Command line interface used by all WakaTime text editor plugins"
arch=('any')
url="https://github.com/wakatime/wakatime"
license=('BSD-3-Clause')
groups=()
depends=('python')
makedepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=(!emptydirs)
install=
source=('https://pypi.python.org/packages/7c/28/7d98467580850eb41d75a6b988fabf68caa0e930882f6f3188fe68a01c8b/wakatime-10.1.0.tar.gz')
md5sums=('e26017168caaf12eafceb129690d97f7')
 
package() {
  cd "$srcdir/$pkgname-$pkgver"
  python setup.py install --root="$pkgdir/" --optimize=1
}
 
# vim:set ts=2 sw=2 et:

After installing the package built from this script, everything works as expected, so I’ve published it to AUR as wakatime. If I’ve made any mistakes packaging this, please report them as issues on the package script’s GitHub repository or leave a comment on its AUR page.

3D Printed Hungarian Cross

The Hungarian coat of arms features an iconic cross with two horizontal beams. In Hungarian it’s called “Kettős Kereszt” which translates to “Double Cross”, usually called the Patriarchal cross in English. This cross is present on other emblems around the area of Central and Eastern Europe too and has been featured on the Hungarian coat of arms at least since the reign of King Saint Stephen of Hungary.

3D model of the patriarchal cross as shown on the Hungarian coat of arms

3D model of the patriarchal cross as shown on the Hungarian coat of arms

Seeing as it’s a Hungarian national holiday today, in memory of the heroes and martyrs of the Hungarian revolution of 1956, everyone has their Hungarian flags out. I decided to do something Hungarian too, while trying out some tools for preparing models for 3D printing. So far I’ve been using Blender, because I have some experience with it, but it’s for creating 3D scenes and although you can use it to design 3D models for printing, it’s not CAD software. This time I tried Autodesk’s web-based program Tinkercad, which although lacking many of the features you’d get in a full-blown CAD program, is plenty enough for me to design simple things like this. Not being a mechanical engineer, I probably wouldn’t even know what features I’m missing!

photo collage of 3D printed "Kettős Kereszt" painted in the colours of the Hungarian flag

3D printed “Kettős Kereszt” painted in the colours of the Hungarian flag

The program is very intuitive to use. I put a few cubes on the workplane, stretched them out into intersecting rectangular boxes and exported an STL file for printing within minutes. You can see a screenshot of the result above. I also made a version with a hole cut out of the top so you could hang it on a key chain. That turned out to be as easy as putting a cylinder in one of the boxes, stretching it out of the top and bottom box faces and marking it as a “hole” in the model.

After scaling the model down to 30% so it fits on my print bed, the final print came out as shown in this photo. It took less than 10 minutes to print at 30% in-fill and seems pretty rigid. I’ve painted on the red, white and green of the Hungarian flag and will hang this up somewhere, who knows, maybe it’ll even be good for a Christmas decoration. If you’d like to print your own Hungarian cross you can download both of my STL files here:

In honour of the heroes! Tisztelet a hősöknek!

Rooting Samsung Galaxy Mini

Samsung Galaxy Mini

Samsung Galaxy Mini

My wife’s phone (Samsung Galaxy Mini GT-S5570I) doesn’t get system updates any more, so I need to manually move Google’s updates into ROM to make space for regular apps. You need root privileges to do this, so I was following these instructions on the XDA Forum which almost work fine. You need to download and apply a file update.zip but the problem is the update script inside doesn’t include S5570I in the list of phone models it checks for, so the script aborts.

All you need to do is edit /META-INF/com/google/android/updater-script inside update.zip and include this phone model in the assertion list, for example, I duplicated lines 15 and 16 and just added an I to the end:

getprop("ro.product.device") == "GT-S5570" ||
getprop("ro.build.product") == "GT-S5570"  ||
getprop("ro.product.device") == "GT-S5570I" ||
getprop("ro.build.product") == "GT-S5570I"  ||

Everything works completely fine after that. Obviously this is not a general solution when rooting, you can’t just blindly add your own phone model into any update.zip not knowing what’s in it, but since this was from a post for specifically this model and it already had several very similar models listed, I thought it was worth the risk and it turned out just fine. Woop! 😎

Steam available in Arch Linux repositories

This news is at least a few days old by now, but it seems the official Steam client for GNU/Linux is now out of Beta and ready for use! Ubuntu users could already download the deb package from the steam website. However, if you’re an Arch Linux user, like me, then you’ll find that since the 26th of February, the steam client is already in the official Arch repositories and can be installed with a simple:

# pacman -S steam

Of course as soon as it’s installed it’s time for Steam to start its slow, perpetual update process, but except for that I think this is fantastic!

Free Software Day tomorrow

If Pockey Lam hadn’t pointed it out I probably wouldn’t have known it was Software Freedom tomorrow. Better than last year though, when I only found out after it had happened. Software Freedom is important to me —most of this blog is related to it— and I’d really like Namibia to participate in this event, especially the Polytechnic of Namibia where I study, as it’s one of the few universities on the African continent mirroring Free Software.

In this effort I’ve written a post on the PoNLUG site and sent some emails in an attempt to get people excited about organising something for an event this weekend or Monday, because I can’t do something like this by myself. I realise it’s probably a bit late to try to get something big going at this point but hopefully we can do something and next year the PoNLUG will be prepared for Software Freedom Day!

Finding photos of a known size

Recently I did a friend a favour and installed Linux Mint on her laptop as she was a bit frustrated with Windows. Unfortunately I assumed she’d backed up everything before handing it over to me, so I re-partitioned the whole drive to ext4. She hadn’t.

On the bright side the computer was quite new and the only thing she wanted from the disk were some photos she’d taken. Well, that just made it my lucky day because there just happens to be a tool specifically for recovering photos (and a myriad of other filetypes) from disks that have been written over: TestDisk! Continue reading

Tab button in GIMP

Status

I just realised that in the GIMP you can press Tab to toggle hide/show the two windows showing layers, tools and so on. Wow! Am I the only person who didn’t know this?! Surely this wins any argument with someone complaining that the GIMP feels more complicated than Adobe Photoshop because it has 3 windows.

Renaming USB Devices in Linux

Sometimes you want to change the name of a USB device, for example because it has no name or because it has a new purpose. I usually give my USB flash drives my own name so that if I lose them, people will know who to return them to.

Modern desktop environments make it easy to rename your device by simply clicking it and selecting ‘rename’ from the context menu. However, sometimes you might want to do this from the command line 8) perhaps because you have no desktop environment, or your desktop environment does not allow you to easily rename your device, or because you feel you could do it faster this way. Continue reading

Namibian Mobile Broadband Settings in Linux

I originally posted this as a Note in the Linux Namibia Facebook group when I still had a Facebook account but I’ve decided to cross-post it here because not everyone uses Facebook and because I still see people having trouble with this. After a few lessons in XML in my Internet Technology course, I contacted local networks and with the cooperation of network staff, I was able to add a little code so that the recent (10 August 2011) update to the mobile-broadband-provider-info package in Ubuntu adds support for Namibian providers MTC, Leo and Telecom. Namibians often seem to have trouble using their cellphones or dongles to get connected on Linux, and the network staff, being unfamiliar with Linux, usually aren’t much help either. This should solve that.
Continue reading