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 600MB and still I barely 200MB 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

Every 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 install those apps. You just need to download CyanogenMod and extract the relevant APKs from system/app/ and copy over the phone. To install them you’ll need to enable installation of apps from unknown source in Settings->Security. It’s best to get a CyanogenMod version that corresponds to your ROM’s version, but I successfully installed apps also from newer CyanogenMod releases.

Opening mobi and epub Files in Ubuntu

You can do it with Calibre and 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 opened correctly. This can be corrected by placing a ebook-viewer.desktop file in ~/.local/share/applications:

[Desktop Entry]
Version=1.0
Name=Ebook Viewer
Comment=Display .epub files and other e-books 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 out for the escape key, or use the Ctrl-[ (which I never got used to).

After seeing a blog post suggesting to map jk to exit insert mode, I was inspired to create my own mapping. I chose kj because it’s faster to type, as typing inwards is faster than outwards (you can check for yourself by tapping with 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 to type the j.

After writing this post, I’ve 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 at GitHub

Eight months after dropping support for binary downloads, GitHub re-enables them and calls them Releases. It’s a welcomed move which in my opinion is vital as offering binary releases is crucial for any project in a compiled language which 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 dependency. 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 which allows, actually requires you, to tag your release in the version control. That’s something I haven’t seen in other project hosting and it’s 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 plain download counter will do, you don’t need the full-blown download stats SourceForge has. I really look forward and hope that GitHub will implement this.

Downloading Audio/Songs from YouTube

Sometimes you come across a video in YouTube and you want to save its audio. Originally I thought it would take some search for the actual URL of the flv source, then downloading it using wget and finally conversion using ffmpeg. But luckily for me, it turns out there is much simpler way to so so: youtube-dl is 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 an 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 with the correct values with your favorite player.

Mozilla Persona

I came across today Mozilla Persona. 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 Player” like Google and Facebook (actually Facebook doesn’t provide OpenID by similar 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 too. For example, if I want to use my Google account as an OpenID to sign into 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 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 our ease of creating alter-egos (and thus keep our anonymity on the net). Facebook and other OpenID like providers require extensive personal information and has real-name policy (which in case of violation can result in blocked account). Persona, by allowing you to register with any email address (think about Mailinator) it allows you to create these anonymous-persona. It also allows you more control on the kind of profile information it shares with providers.

There is 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 bot 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 there exists a project with the desired name.

Usage is quite simple:

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

Currently the script is in early stage, and can search for projects in Debian’s list of packages and in SourceForge. The code is available is hosted in 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 welcomed.

Haaretz Premium Bypass Userscript POC

Haaretz site became paywalled a couple of months ago, allowing reading 10 “premium” articles before requiring payment. After a friend recommended their app for smartphones, which unlike the site is free, I started reading it mainly on my phone. Few days ago I had no internet connection on my phone, and instead of seeing an article I saw an error page saying it’s not reachable (the usual android’s 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 in 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 a head and wrote a simple proof-of-concept Greasemonkey script to demonstrate replacing missing premium content in the desktop site by 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 which get through Akismet, which is kind of the de-facto spam filtering for WordPress. Twice a day, on avearage, I had to manually mark comments as spam, which really got under my skin. After writing that post, I’ve looked at a number of solutions.
Continue reading Dealing with Spam – Follow-up