I will be discontinuing to post on this blog and instead starting a new blog at http://nepcoder.com. Thanks!

Github has become the darling for both serious and hobbyist open source developers who like using the Git distributed version control system. Apart from hosting code and collaborating on projects, people have been using Github in other interesting ways like Gitorials (Tutorials where every step is explain in an individual git commit i.e. Git + Tutorial) and creating repositories solely for documentation / wikis only.
“nixhacker” is a small project I have started on Github solely for the purpose of sharing “Various resources for the *nix command line hacker“. There is only one document in the repository -> README.textile which is a textile file similar to markdown and other lightweight markup languages that Github supports for the README file of a project hosted there.
Please feel free to suggest additions/changes to the page.
Posted in code, git, github | Leave a Comment »
Below are solutions for two Project Euler problems using Ruby one-liners. It is true that one-liners are guilty pleasures for most programmers and generally should not be used in production code. However, for programming puzzles/challenges like Project Euler it is fun to try such hacks.
# Project Euler: Problem 1
# Find the sum of all multiples of 3 and 5 below 1000
puts (1...1000).select { |n| n % 3 == 0 or n % 5 == 0 }.inject { |sum, n| sum + n }
# Project Euler: Problem 16
# Ugly one liner hack for calculating the sum of the digits of 2^1000
sum=0; (2**1000).to_s.split("").each{ |n| sum+= n.to_i };puts sum
Posted in hack, project euler, ruby | 4 Comments »
Wordle is an interesting web app that generates clouds of words. This blog and my twitter feed serve the prupose of being a stream of my thoughts and ideas. So I was very interested in what kind of Wordle my words from 2008 would generate. The images below are the output generated via this web app.
This blog :
Twitter feed :
If you are interested in generating your cloud, get it from here.
Posted in rant, stats | Leave a Comment »
While reorganizing the contents of my hard drive I came across this presentation I had prepared for my Operating Systems class. Below is my “Linux Kernel 0.01″ presentation :
If you cannot view the presentation above. You can also access it here.
Posted in computer science, linux | 2 Comments »
Thanks to mileszs for posting a comment on the last blog post and informing me of a better way of generating vim’s syntax highlighted code as html :
The standard way to do this is to type :TOhtml. If you first enter :let html_use_css = 1, and then highlight some code, and then issue :TOhtml, you will get HTML that doesn’t use font tags, but instead uses CSS to provide your syntax highlighting.
Posted in hack, tips, vim | Leave a Comment »
WordPress has a wonderful source code highlighting feature via the sourcecode tag. However, publishing source code online can be a pain and ends up looking up ugly and messed up without resorting to using some sort of syntax highlighter.
Vim is my weapon text editor of choice. I don’t claim it is the ultimate text editor but it fulfills my current needs for writing code. Vim’s syntax highlighting is a standard yet appreciable feature. So after some googling around I came across a solution posted by Maciej Bliziński which saves the syntax highlighted source code you would view inside vim as good old HTML. The magical vim command is:
Below is a screenshot showing the output of the above vim command which generates the HTML for the source in a split window view:
The html generated above viewed in Konqueror:
Posted in hack, tips, vim | 4 Comments »
Tetris has probably been coded in all kinds of programming languages and for everything from computers to calculators, phones and next-gen gaming consoles. I randomly came across sedtris.sed written in sed(stream editor : Unix command line utility for text manipulation)
Posted in hack, sed | 1 Comment »
Accessor methods let you “set” or “get” instance variables belonging to an object. Most Java programmers are introduced to getters and setters very early in their OOP education. Lines of code might not be a reliable metric to compare programming languages but nevertheless below is a simple example for creating getters and setters in both Java and Ruby :
Java ->
public class Getset
{
private int value;
public void setValue(int n)
{
value = n;
}
public int getValue()
{
return value;
}
}
Ruby->
class Getset attr_accessor :value end
Posted in java, programming, ruby | 3 Comments »
1! + 4! + 5! = 145
Posted in maths | 3 Comments »




