Wednesday, January 25, 2012

Git Reference card

Git create remote branch

To create a local branch
git branch branch_name
To switch/checkout local branch
git checkout branch_name
You can combine above two in one step instead
git checkout -b your_branch
Create remote branch (so that other co-workers/programmers/whoever can pull)
git push -u origin your_branch
Others can pull this by
git checkout origin/your_branch

View diff in GIT

What you will commit
git diff

diff between two branch
git diff master..branch_1
diff since last commit
git diff HEAD
This entry is a note to self for being amnesiac
.

Monday, November 28, 2011

Disqus(ted)

Great added Disqus to blog. Looks like I lost all old comments (of whatever few I had).

Tuesday, June 21, 2011

Monday, June 20, 2011

Install ruby using RVM

This is note to self, for installing ruby 1.8.7 using RVM. Other versions can be installed in same way "mostly". Just replace the version 1.8.7 with version intended

Verbose documentation about RVM installtion can be found at https://rvm.beginrescueend.com/rvm/install/

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >>

add above line in ~/.bashrc file in the end

rvm package install zlib
rvm package install openssl
rvm install 1.8.7--with-openssl-dir=$HOME/.rvm/usr
rvm use 1.8.7 --default

zlib and openssl is required in many cases.

Wednesday, June 08, 2011

Sinatra: memcached as session store

A simple route for using memcached as session store.

require 'rubygems'
require 'sinatra'

use Rack::Session::Memcache, :memcache_server => 'localhost:11211', :expire_after => 3600, :namespace => "sinatra.chandankumar.com"

get "/" do
"value = " << session[:value].inspect
end

get "/set" do
session[:value] = params[:value].inspect
redirect "/"
end

This would enable you to spawn multiple instances of (same) Sinatra app while sharing session store to achieve non sticky session. Helps scaling the front end.

Wednesday, June 01, 2011

Sinatra Ajax File Upload

Valums script at http://valums.com/ajax-upload/ works like a charm in sinatra route you would require something like

  get :upload do
render "/test/upload", :layout => false
end
post :upload do
logger.debug params
newf = File.open("public/post.jpg", "wb")
newf.write(request.body.read)
'{success:true}'
end

Thursday, October 07, 2010

Tools that rule

Here goes a list of application that makes my computer life simpler (applications for Windows mostly, some of them are cross platform someway or the other).

  • Chrome:- Browser without any fuss, its fast (in fact lightning fast). Alas Firefox is no more my favorite.
  • Launchy: When you have laucnhy you forget your start menu. You would never need to use mouse to start any application installed on your computer. This nifty stuff indexes start menu to make your life easier.
  • Notepad++: I ditched textpad for this. This is a must have application when you are dealing with text file to source code that you want to edit quickly. (FOSS)
  • 7-zip: winzip is a malware, if you want something not annoying, 7zip simply does the job. It can handle a lot of different type of archive files. (FOSS)
  • Dropbox: Dropbox allows you to sync your files online and across your computers automatically.
  • Pidgin: Once you have Pidgin, you dont need to download several messengers. Connect to AIM, MSN, Yahoo, and more chat networks all at once. (FOSS)
  • Windows Media player: On windows Windows Media player simply does the job, plays music, plays movies. Just install codec appropriately and you would never need to use any other player.
  • Libre Office (Previously open office). Almost a drop in replacement for Microsoft Office. This stuff is undermined, yet hell powerful and yet completely free, if you are looking for something that works and works free of cost Libre Office is here for you. (FOSS)
  • Gmail: Simply the best Email one can have. Period.
  • Google Calendar: For managing your calendar. There are a lot of stuff that you can do with Google Calendar, reminders on SMS, Email, Birthday reminders etc.
  • Google Contacts: I use to hate Google Contacts, but hey Google is evolving, this is my "the" contact manager! It's dead simple and its easy to use and sync up with several devices and apps.
  • Google History: In case you surf a truck load of websites and you are lazy in bookmarking Google History can remember what you visited.
  • Google Reader: RSS reader, the best so far for me. Note that this can work offline as well with Google Gear.
  • Simplenotes / Evernote: This is by far the best "text" note taking platform. It functions cross platform, for that matter I got this working on my Android Phone as well :). In the past I used Evernote, unfortunately I find it painfully slow. The advantage of evernote is that it can clip websites and I hence your notes can have photos. If you are looking for fancy note taking application evernote is the way to go. 
  • Picasa: Photo manager free of cost. If fancy editing capabilities is not a requirement this stuff is simply awesome. It's lightweight has several cool basic features and its fast.

This list is not yet over, but I was a bit eager to post it. I hope to continue to update this as and when I come across something more.