Galaxy S2 – Clearing Logs on an Unrooted Phone

I have a Samsung Galaxy S2 using an unrooted stock ROM. Lately, I couldn’t update any of my apps or install new ones, as every time I tried, it would complain about Insufficient storage available. This was weird, as according to my phone, the apps took less than 600 MB, and yet I had barely 200 MB of free space in my device memory.

SysDump
SysDump
Continue reading Galaxy S2 – Clearing Logs on an Unrooted Phone

Using CyanogenMod’s Apps on Official ROM

Ever since I switched back from using CyanogenMod ROM to the official ROM (due to modem problems), I missed some of the custom apps. It turns out to be really easy to install those apps. You just need to download CyanogenMod and extract the relevant APKs from system/app/ and copy them over to the phone. To install them, you’ll need to enable installation of apps from unknown sources in Settings->Security. It’s best to get a CyanogenMod version that corresponds to your ROM’s version, but I successfully installed apps from newer CyanogenMod releases as well.

Opening mobi and epub Files in Ubuntu

You can do it with Calibre, specifically with the ebook-viewer program that comes with it. However, for some reason, the packagers didn’t ship a desktop file to accompany it, so you can’t just double-click on ebooks and have them open correctly. This can be corrected by placing an ebook-viewer.desktop file in ~/.local/share/applications:

[Desktop Entry]
Version=1.0
Name=Ebook Viewer
Comment=Display .epub files and other e-book formats
Type=Application
Terminal=false
Icon=calibre
Exec=ebook-viewer %f
StartupWMClass=ebook-viewer
MimeType=application/x-mobipocket-ebook;application/epub+zip;
Categories=Graphics;Viewer;

Quickly Exiting Insert Mode in Vim

Changing from insert mode to normal mode is usually quick. The other direction is more cumbersome. You either have to reach for the Escape key or use Ctrl-[ (which I never got used to).

After seeing a blog post suggesting mapping jk to exit insert mode, I was inspired to create my own mapping. I chose kj because it’s faster to type, as typing inward is faster than outward (you can check for yourself by tapping your fingers on your desk). To use it, add the following to your .vimrc:

:inoremap kj <ESC>

Now, whenever you are in insert mode, quickly typing kj will exit insert mode. It will introduce a short pause after typing k, but this is only a visual one, so it doesn’t actually slow you down. kj is one of the rarest bigrams in English, so you’ll almost never have to actually type it inside a text, but if you do, just wait a bit after typing k before typing the j.

After writing this post, I came across a Vim Wiki page listing all kinds of ways to avoid the Escape key.

I’ve recently published my vimrc; take a look – it might give you ideas for other neat tricks.

Binary Downloads Are Back on GitHub

Eight months after dropping support for binary downloads, GitHub re-enabled them and calls them Releases. It’s a welcome move, which in my opinion is vital, as offering binary releases is crucial for any project in a compiled language that targets end users (as opposed to developers). Plainly put, when a user wants to download and use some software, he doesn’t want to mess with compilation issues and dependencies. Unless, of course, he is a Gentoo user, and then he’s probably more of a developer than a regular user.

The new GitHub releases have a nice feature that allows, actually requires, you to tag your release in version control. That’s something I haven’t seen in other project hosting services, and it looks really positive. However, they still lack a basic feature SourceForge has had for years: download stats. It’s really nice to be able to know how many people downloaded each release of your project. Even a plain download counter will do; you don’t need the full-blown download stats SourceForge has. I really look forward to and hope that GitHub will implement this.

Downloading Audio/Songs from YouTube

Sometimes you come across a video on YouTube and you want to save its audio. Originally, I thought it would take some searching for the actual URL of the FLV source, then downloading it using wget, and finally converting it using ffmpeg. But luckily for me, it turns out there is a much simpler way to do so: youtube-dl is a small Python script that does it all. It will download and extract the audio from a YouTube video without any hassle.

Installation is quick via pip:

$ pip install --user youtube_dl

Note that there is an underscore there instead of a hyphen. youtube-dl is also available in Ubuntu’s repository; however, the version there is too old and didn’t work for me. The --user flag tells pip to install it for the current user (I just don’t like installing unnecessary things as root :-)). Now all you have to do is:

$ youtube-dl --extract-audio http://www.youtube.com/watch?v=XXXXXXXXXX

All that is left is to fix the metadata tags of the file to the correct values with your favorite player.

Mozilla Persona

I came across Mozilla Persona today. It’s a Single Sign-On (SSO) system that is similar to OpenID. While it looks like there is no need for yet another SSO, it does have some promising features compared to OpenID, and especially OpenID provided by “Big Players” like Google and Facebook (actually, Facebook doesn’t provide OpenID but a similarly working Facebook Connect).

The one main benefit is privacy. The first kind of privacy is related to the provider. In OpenID, the provider knows exactly where you’ve logged in to. For example, if I want to use my Google account as an OpenID to sign in to a gardening forum, Google will know that I’ve signed up there, and they will get notified every time I sign in. Persona, on the other hand, seems to sidestep this issue. After registering with a Persona provider (Mozilla offers one), the provider gives the user a cryptographically signed token, which he can present to sites he signs in to. The site can verify the validity of the certificate without telling the provider which user it wishes to validate.

Another aspect of privacy provided by Persona is how easy it is to create alter egos (and thus keep our anonymity on the net). Facebook and other OpenID-like providers require extensive personal information and have a real-name policy (which, in case of violation, can result in a blocked account). Persona, by allowing you to register with any email address (think about Mailinator), allows you to create these anonymous personas. It also allows you more control over the kind of profile information it shares with providers.

There is one last remaining issue, which still concerns me. If you use an OpenID provider, such as Google, and it decides to block your account, then you lose access to all those places you authenticated to using that account. This can be worked around by setting up your own OpenID provider, but that’s not simple. I’m not sure if Persona offers an easier way around it.

Overall, Persona looks very promising as an alternative to OpenID. If anyone has real experience with it, I would love to hear.

name-taken – Check if your project name is taken

Every time I want to start a new open-source project, I come across this small “problem”: making sure that the name for the project isn’t already taken. Today I decided to solve it by creating a simple script that queries different open-source repositories to check if a project with the desired name exists.

Usage is quite simple:

$ name_taken.py enlightenment
Debian: Name not taken :-)
SourceForge: Name taken :-(

Currently, the script is in an early stage and can search for projects in Debian’s list of packages and on SourceForge. The code is hosted on GitHub: https://github.com/guyru/name_taken, and licensed under GPL2 or higher. Suggestions on how to make this tool more useful (and, of course, patches) are really welcome.

Haaretz Premium Bypass Userscript POC

Haaretz‘s site became paywalled a couple of months ago, allowing users to read 10 “premium” articles before requiring payment. After a friend recommended their smartphone app, which unlike the site is free, I started reading it mainly on my phone. A few days ago I had no internet connection on my phone, and instead of seeing an article I saw an error page saying it wasn’t reachable (the usual Android built-in browser type). The URL was something like http://www.haaretz.co.il/misc/smartphone-article/.premium-1.2070500, while the URL for the same article on the regular site is http://www.haaretz.co.il/news/world/middle-east/.premium-1.2070500. This of course got me curious, and a quick check showed that there is no problem accessing the mobile version from a desktop browser. So I went ahead and wrote a simple proof-of-concept Greasemonkey script to demonstrate replacing missing premium content on the desktop site with content intended for the smartphone app.
Continue reading Haaretz Premium Bypass Userscript POC

Dealing with Spam – Follow-up

In the beginning of June, I wrote about the rising number of spam missed by Akismet. The main issue was a noticeable increase in the number of spam messages that get through Akismet, which is kind of the de-facto spam filter for WordPress. Twice a day, on average, I had to manually mark comments as spam, which really got under my skin. After writing that post, I looked at a number of solutions.
Continue reading Dealing with Spam – Follow-up