An entity composed of reality and pseudo-reality. Enjoys coding, news, history, photography.
A bit of Ruby, a bit of JavaScript, a bit of love...
I like writing in Vim! It is one of those things that I am so used to
that every other text editor feels unnatural and going against the
grain. So I thought I'd write a small plugin to post to Posterous. Add
the following code to your .vimrc. Also make sure you have python
enabled in vim as well as have markdown2 for python installed.
curl -u my@email.com:mYpA$$W0RD http://posterous.com/api/getsites
This is the title of the post This is the body of the post.This code is pretty straightforward and sparse because I am using this
(import '(java.net URL HttpURLConnection) '(java.io InputStreamReader BufferedReader)) (defn http-client-get-content [reader content] (let [line (.readLine reader)] (if (nil? line) content (recur reader (str content "\n" line))))) (defn http-client-get [url] (let [connection (.openConnection (URL. url))] (doto connection (.setRequestMethod "GET") (.setDoOutput true) (.setReadTimeout 10000) (.connect)) (http-client-get-content (BufferedReader. (InputStreamReader. (.getInputStream connection))) "")))
Lately, I've been trying to compile Chromium on my desktop and I had been constantly getting an error associated with linking:
collect2: ld terminated with signal 9 [Killed]After Googling around apparently the problem had to do with running out of swap space which causes the linking to fail. Chromium needs almost 700mb more memory to link than I was providing so it was failing. Interestingly, Linux has a really clean solution to increase the swap space.
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576 sudo mkswap /swapfile sudo swapon /swapfileThese three commands will create an empty file of 1gb, make that a swap file, and turn it on to be used.
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Polareye" ofType:@"jpg" inDirectory:@""]];
Here is yet another piece of code that I am making open source. It is called iPolarized. I am not done with it, but thought I'd make it open source in the early process. The major functionality that of making the picture a polaroid is done, but all the stuff related to making the app intuitive is sort of missing, plus there are a few bugs in there I need to work out.
Here are some example photos:





I dislike GUI tools and posting to Flickr usually seems like a chore more than as an enjoyable means of posting new pictures. With that in mind I have written this command line Flickr uploader. It will be a constant work in progress where I will add features as I need to use them. So with that in mind download it from here.
In a sign of being awesome Posterous now lets you post Github Gists which are automatically converted into the embed code. Basically, what you need to do is paste the link to the gist in question and it is automatically translated into the embed code.