Google
 
Showing posts with label hack. Show all posts
Showing posts with label hack. Show all posts

Saturday, May 14, 2011

Fixing overused touchpad with sticky note

If you're like me who spends more time with laptop than anything/one else, you'll end up with touchpad like this:

Due to overuse, the outer coarse layer wears off and touchpad starts acting funny. Plus it's difficult to slide your finger over it.

Fix? Stick a sticky-note over the touchpad. This surprisingly works!

Tuesday, December 14, 2010

HackJatra v0.1

Jitendra started the discussion, but i wouldn't be wrong if i say we all had the itch. A hackathon was in everybody's mind since quite a while. So we started a email discussion among fellow hackers, mostly Pulchowk Campus BCT'ians. We had few projects in mind - ATM Locator, Khanchuwa and Online Nepali Donation system. All we needed was a date for the event. But before we could finalize that, we coined a term for the event.

HackJatra. For non-Nepalis out there, Jatra means festivity. Later the term was also informally understood as "Hack by day, Jatra by night" :P. More on that later..

Finally, we fixed the date and venue: 11th December, 2010 at IT Park Banepa, starting from 9am.


The project we did were:

1. ATM Locator
Map enabled app to list and search ATMs in Nepal.
Team: Abhinav Singh, Bibek Shrestha, Jitendra Harlalka, Subodh Satyal, Sushil Shilpakar

2. Khanchuwa
Community based delicacies listing portal. The idea was discussed at BarCamp Kathmandu 2010.
Team: Jwalanta Shrestha, Abhishek Singh

3. Tweet NEA
Automated twitter accounts to tweet the loadshedding schedule.
Team: Manish Modi, Suraj Sapkota

More on the projects in the wiki.

Needless to say, the event was extremely fun. The joy of hacking for fun with extremely talented fellow hackers is indescribable. The projects we started are almost done; few more hours of collaborations and they'll all be ready to launch.


Future plans:
1. Do some branding of HackJatra; create a logo, have a website and make the projects more accessible and sharable.
2. Encourage other teams to do similar HackJatras
3. Do another HackJatra ASAP

O BTW, we even had booze party by night (Jatra :P)

Friday, November 12, 2010

Generating Tag Cloud the Unix way

UPDATE: I've modified the script to add color and transparency :)

Ushaft's this tweet on creating tag cloud caught my attention. While there are better tools available online, i decided to give it a try in Linux :)

First we need to generate a frequency list of words out of a file. No brainer. I used the GNU/GPL license as source text.

cat /usr/share/common-licenses/GPL |
tr 'A-Z' 'a-z' |
sed 's/[^a-z ]//g' |
sed 's/\s/\n/g' |
awk '{if (length($1)>=3) print $1 }' |
sort | uniq -c | sort -nr > freq.txt

Explanation (per line):
1. Print the license
2. Convert to lowercase
3. Remove punctuations
4. One word per line
5. Discard words with 2 or less long
6. Grab frequency and write to freq.txt

freq.txt needs some editing to remove irrelevant words like "the", "but", etc.

Now to create tag cloud, i wrote a simple awk script that outputs svg file. Saved this as gentagcloud.awk (Please change the width, height and scale variable to your taste)

#!/bin/awk -f

BEGIN {
WIDTH=1000
HEIGHT=600
SCALE=1

OFS=""

print "<?xml version=\"1.0\"
encoding=\"UTF-8\" standalone=\"no\"?>"
print "<svg width=\"",WIDTH,"\" height=\"",
HEIGHT,"\" version=\"1.1\"
xmlns=\"http://www.w3.org/2000/svg\">"
}

{
R = int(rand()*9)
G = int(rand()*9)
B = int(rand()*9)

print "<text style=\"fill:#",R,G,B,";opacity:0.75;
font-size:",$1*SCALE,"px;\"
x=\"",rand()*(WIDTH-100),"\"
y=\"",rand()*HEIGHT,"\">",$2,"</text>"
}

END{ print "</svg>" }

Now to create tag cloud,

awk -f gentagcloud.awk < freq.txt > tagcloud.svg

Tada! Tag cloud generated, view tagcloud.svg in your browser or image viewer

If you have ImageMagick installed, you can convert it directly to png too. (Transparency isnt handled properly. If you have workarounds, please comment)

awk -f gentagcloud.awk < freq.txt | convert - tagcloud.png

BTW, the tag cloud was like this: (lil' ugly, but WTH :))

Friday, February 19, 2010

Overriding extension compatibility check for FF3.5+

Disabling extension compatibility check for Firefox was easy. Go to about:config and create a boolean value named extensions.checkCompatibility and set it to false.


Until Firefox 3.5!
(More specifically, products that are based on < Gecko 1.9.2)

Newer Firefox requires you to append version number to the variable. This will ensure the extension override wont work forever as FF is upgraded to next version. For example, in Firefox 3.6, the variable would be extensions.checkCompatibility.3.6

Explained in detail here:
http://kb.mozillazine.org/Extensions.checkCompatibility