Trying out the cheat codes before you play the game

Did I mention how much I love analogies? Can’t stop but post when I come across a good one. 🙄

From /r/vim:

I have two half brothers who came along when I was 11. When they were old enough to play video games, I got them a good one, and just to round out the present and make it a two-stack of wrapped gifts, I threw in the big walkthrough/cheats guide book. I’d had a few of those back in the mid/late 80s for Nintendo, which I would turn to when I got really stuck, or after I beat a game to go back and have some additional fun cheating.

To my horror, they ran into the other room, put in the game, then opened the book and found the cheats and put in several cheat codes before even playing! They wouldn’t even hear of not doing it. It’s what “everyone” did. I’m fine with cheating for fun like that – I did it – but at least play for awhile so you can tell you are cheating. How are you going to think “Ah, that’s much better now that I don’t die as often” unless you’ve died often for a bit to set a baseline? How are you going to think “Wow, the light saber makes this level ridiculously easy” unless you knew that there is no light saber in the normal game, and it’s actually a difficult level without that easter egg?

How will you even know what Vim even is if you’ve immediately bolted on a bunch of upgrades? How are you going to ask for help? “Hey guys, I’m not sure if this is a Janus thing, or something from my coworker’s configuration, or one of the 15 plugins I installed, because some guide said they were cool (I have no idea, I’ve never really used Vim before!), but, uh… when I press ‘b’, isn’t it supposed to go back a word? It’s doesn’t.”

Yeah? Well, good luck.

Don’t fork

The gist a simple git branching model has gained much popularity lately. The author mentions some drastic changes to the normal git flow like merging changes from feature branches straight into master. This is necessary to maintain simplicity.

There are some notes to the end of the gist. Among them is one titled “Don’t fork. Push feature branches to main repo.”.

Sometimes I see people forking repositories in order to issue pull-requests. Yes, you may have to do this when contributing to open-source projects you don’t regularly contribute to. But, if you are a contributor, or working in the same org, get push rights on the repo and push all your feature branches to it. Issue pull requests from one branch to another within the same repo.

Because the whole fork and pull-request mechanism can be devastating sometimes, you don’t need to consider such sophisticated schemes for small teams. Let’s face it, only a fraction developers out there have the itch to really learn the tools they are using. You’re lucky if more than half of your team is well-versed with at least the basic git commands.

When you can afford it, it’s always a good idea to have a central repo and give everyone write permissions. You can even fine-tune the permissions to specific branches if your git server runs gitolite. AFAIK, this is not possible with github or gitlab.

Subscription URLs for popular feed readers

Here are the feed subscription URLs to add new feeds to some of the most popular feed readers out there:

Newsblur
http://www.newsblur.com/?url=%s

Feedly
http://cloud.feedly.com/#subscription%2Ffeed%2F%s

The Old Reader
http://theoldreader.com/feeds/subscribe?url=%s

Bloglines
http://www.bloglines.com/login?r=/sub/%s

The %s should be replaced by the feed URL you are going to add. You can use these to add custom readers to extensions like Chrome’s RSS Subscription Extension.

I couldn’t find the URLs for Digg Reader and Blogovin which seem to be popular among many. 😕 If your feed reader doesn’t give a good public API it isn’t worth staying at anyway. 😉

C++ as a scripting language

Jussi Pakkanen of Canonical writes:

With the release of C++11 something quite extraordinary has happened. Its focus on usable libraries, value types and other niceties has turned C++, conceptually, into a scripting language.

I don’t necessarily agree with everything on that post, but one thing’s clear: C++ isn’t what it used to be. With C++11 things have changed, a lot.

If I was to write a script it’d be python or a shell script, I wouldn’t even consider C++. But then again, if that is some script you need to run every once in a while or one that has to be run over and over again within a short period of time, why not just write it in C++ and compile to native code? It would run faster than any other scripting language would, without waiting for some runtime or VM to load up.

And now you don’t need to learn the ins and outs of pointer arithmetic to do this. 😉

Python import and easter eggs

Amir Rachum has a good primer on python’s import. If you’re new to python you should definitely give it a go.

The post ends up with some cool import easter eggs.

import antigravity
import this
from __future__ import braces
import __hello__
from __future__ import barry_as_FLUFL

Try them yourself in a REPL 🙂

Github and Government

Git’s being used to do many more things besides version controlling code. I once wrote about tracking laws with git in Germany.

Github has introduced government.github.com. From their blog post:

Governments at all levels have been using GitHub for some time now to build better, more accessible websites, publish laws and data, and even collaborate on policies themselves.

Today we’re proud to announced the launch of government.github.com, a website dedicated to showcasing the amazing efforts of public servants and civic hackers around the globe.

Open data projects in github isn’t new. Concepts like forking your city shows the possibilities are boundless.

Random limerick

A preoccupied vegan named Hugh
picked up the wrong sandwich to chew.
He took a big bite
before spitting, in fright,
“OMG, WTF, BBQ!”

pkill script for cygwin

pkill is a basic necessity of life. For cygwin, this comes in the package procps which is not available for x64. You can of course ps and grep then awk but who has the time.

This small script from cygwin mailing list archives to the rescue:

#!/bin/sh
# pkill
# be VERY careful with parameter $1
case $1 in
'' )
cat "$0"
;;
* )
for pid in $( ps -aW | grep -i $1 | awk '{ print $4 }' );
do tskill $pid /V;
done
;;
esac
view raw pkill hosted with ❤ by GitHub

tskill is actually a kill equivalent in the Windows world.

Kasparov to run for president

From chess.com:

On Monday night in Tallinn (Estonia) Garry Kasparov announced his candidacy for the 2014 FIDE Presidential Elections. The 13th World Champion aims to “revitalize FIDE with a focus on serving the national federations and raising the commercial profile of chess worldwide.”

They also have an exclusive interview with Kasparov about the decision.

The current president, Kirsan Ilyumzhinov, has been on the position since 1995.

Ghost is here

Ghost, the much awaited blogging platform, is finally here. You need to sign up to download.

It only took me 5 minutes to download and have Ghost up and running. You download the file, run an npm install (yes, it’s built on node.js), run sudo npm start and bang! Ghost is ready. The interface is minimal and clean, you can write with markdown, and there’s a marketplace for themes. And there are guides on deploying Ghost on various platforms like Amazon EC2, Digital Ocean and Azure.

They are planning to run a hosted Ghost platform as well (like they do at wordpress.com for WordPress), and they’ll be rolling it out in the coming weeks.

Note that Ghost needs a node.js server running so you can’t host it like a static site in places like Dropbox or with most shared hosting providers. But you can use an Amazon Micro EC2 instance for free for one year. The database used is SQLite, so it won’t be practical to run this on Heroku.