« Back to the main page


A tiny intro to Python ctypes
If you've ever been interested in interfacing with shared libraries and DLL using Python, then there are basically three ways you can achieve it. One is to use Python/C API, second is to use SWIG and the third which I will demonstrate is to use ctypes. ctypes is a great companion to keep around as it allows one to call functions and extract data as C types from a shared library without leaving the pleasant world of Python. Without further ado, let me roll some code. //ctypedemo.c
#include 
#include 
#include 
char* getenv2(char * environment)
{
  fprintf(stdout,"getenv2(%s)\n",environment);
  fflush(0);
  
  return getenv(environment);
}

int _init()
{
  printf("%s\n","Loaded ctype shared library");
  return 0;
}

#ctypedemo.py
from ctypes import *
from ctypes.util import find_library
import sys

ctype_sl = cdll.LoadLibrary('./libctypedemo.so.1') # load library

getenv_ = ctype_sl.getenv2(sys.argv[1]) # get 1st arg
ret = c_char_p(getenv_) # cast to char*
if ret:
    print "\{0}={1}".format(sys.argv[1],ret.value)

#sharedlibcompile.sh
gcc -Wall -fPIC -c ctypedemo.c
gcc -shared -nostartfiles -Wl,-soname,libctypedemo.so.1 -o libctypedemo.so.1 -lc ctypedemo.o
export LD_PRELOAD=./libctypedemo.so.1

$ls
ctypedemo.c
ctypedemo.py
sharedlibcompile.sh

$./sharedlibcompile.sh
$ python ctypedemo.py PATH                                                        
Loaded ctype shared library
getenv2(PATH)

value for PATH=/usr/local/bin:/usr/local/sbin/:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/sbin:/bin:/usr/games
Hope you enjoyed the tiny intro. Feedbacks are welcome (constructive or destructive otherwise).

Posted: 2009-12-13 04:38:00

phew
 It has been a long time since I blogged. More so due to work reason. I have been busy at work implementing Django-based extraction and analytical platform along with helping refactor tracking system and analytics software amongst others.

When I first started playing around with Django early this year, I thought it was just another fad. I was so wrong! The framework is beautifully written using the concept of MVC (Model-View-Controller)*. You see, I am primarily an application developer software who had no interest in implementing web-based software. JEE software wasn't my cuppa tea but with Django, I am completely in control of each layer of interface down from database models right upto the template :). In essence, it has re-invigorated my interest in web-development and JEE as well.

I can only go so far as to say that Django is a beautifually mastered piece of framework which in days to come will only see a rise in its usage. Django framework is thankfully and proudly an OSS software!

* Except the Django developers call it MTV (Model-Template-View) heh.

Posted: 2009-09-05 15:23:00

This is nasty (Sockstress)

I was going through the details about socktress[0][1] on Slashdot[1] today. I could not believe that TCP/IP specification itself could be distorted yet again. By starting a 3-way handshake in userspace, an attacker would exhaust remote systems' connection table (similar to SYN Floods of the old days[2]) filling up with arbritrary SYN packets on the remote end. On receiving the first ACK from the remote end, the attacker would presumablyn gets hold of the packet in userspace using libpcap[3] and manipulates it however the attacker wishes because theoretically as the paper points out the kernel is suppose to panic and send RST to the remote end (the one the attacker is attacking) because fore sure kernel  didn't ask for an ACK packet now did it[4]? :-) 

The patch to fix SYN DoS in kernel[3] was invented by Daniel Bernstein. It basically did not establish (read: connection state in ESTABLISHED state/3-way handshake complete) the connection until a 3-way handshake was completed in totality - SYN, SYN/ACK, ACK and it used extra crufts to calculate if it was _really_ completed. And what about the one way before SYN flooding? I remember reading a paper about TCP/IP Sequence ID prediction. I do not remember majority of that paper but it essentially pinned down that a remote attacker could predict the sequence ID number of the next packet coming in and hence forge a prepared reply (a spoofed packet destined for somewhere else). 

All these brings me to the deep question seated within me. How much more problems/inherent weaknesses can TCP/IP itself handle? Do we need a new specification AND implementation? That I don't know and I do not have enough years on my belt to design one but it sure sounds like TCP/IP _really_  isn''t designed for today's network security standard of how easy it might be for an attacker to establish DoS. This sure isn't the 70s, 80s or the 90s when programmers were a happy hacker[6]. Thankfully, CISCO IOS and Microsoft Windows has released a patch today. :-)


[0] http://www.sockstress.com 

[1] http://it.slashdot.org/story/09/09/08/1839258/Microsoft-Cisco-Finally-Patch-TCP-DoS-Flaw


[2] http://insecure.org/stf/tcpdos/outpost24-sect-sockstress.pdf (A really good paper if you are interested in network security/programming and system administrator. It is also good for learning the intricacies of TCP/IP stack from a real-world perspective as TCP off-loading implementation _in_ hardware could possibly peruse this knowledge). 

[3] I remember someone implemented SYN cookies or "canaries"? code for Linux kernel (I read about this only couple of years ago after I got more interested in network codes). Yep. it is DJB :-) the inventor of syncookies; who can forget 44 vulnerabilities that his students found in unix kernel? :-)  http://marc.info/?t=110321890800003&r=1&w=2.

[4] If you were curious and flipped here, then you'd obviously know that the userspace started all this hohalla. Post to get an ACK'ed reply in attackers machine, having a libpcap event handler that notifies the userspace code of the incoming packets and sniff the header/payload and then reply back without ever hitting the kernels' tcp stack! This is a bit confusing to me since libpcap itself would need to interact with the kernel using normal execution syscall path via libc right? Or, am I dreaming?

[6] The original "hacker" term. Yes the one that describes someone as being curious, benign and prides in intellectual drive. Who knows some day our aliens overlords might try bringing with them a system that only an hacker understand :-)

Posted: 2009-09-09 23:58:00

No more LJ [I am back yay!]
Dear friends, LJ'ers and rest of the internet,

Its been a pleasure using LiveJournal for a whole year (and half) but due to my personal need, I will be no longer using LiveJournal for blogging. Instead I run wordpress which can be reached @ http://bokey.mine.nu/blog

I look forward to interacting with you all in my new blog :)

I will close this account on March 1, 2009.


I am back! :)





Posted: 2009-02-07 21:56:00

Sigh.. it's been a while..
and time goes so quick... <sigh> http://osdir.com/ml/linux.redhat.ppp/2003-09/msg00042.html
Posted: 2008-11-03 01:13:00

aussie partygoers
LMAO! http://au.youtube.com/watch?v=qm61svN4U5g

:)


Posted: 2008-11-04 23:40:00

template shell sort
This has got to be fscking documented somewhere c'on Google you can do better!!! Ki$$ my @$$!!

//Shell sort (Knuth, Vol. 3, pg 84)

template<class T> void sort(vector<T>& v)
{
  const size_t n = v.size( );
 
  for ( int gap = n / 2; gap > 0; gap /= 2)
    for ( int i = gap; i < n; i++)
      for ( int j = i - gap; j >= 0; j -= gap)
           if ( v[ j + gap ] < v[ j ])
           {
             T temp = v[ j ] ;
             v[ j ] = v[ j + gap ] ;
             v[ j + gap ]  = temp;
           }
}



Posted: 2008-11-17 17:21:00

Dell Vostro fan not working?
One of my friend r11t has Dell Vostro 1500 laptop and his fan was not spinning up/down with Ubuntu. He solved this problem by installing a userspace program called dellfand. If your laptop is overheating [and eventually shutting down], you can solve it by installing it which he says manually powers the fan up/down. Shamefully plugged from https://wiki.ubuntu.com/InstallingUbuntuOnADellVostro1700 - 4. For FAN Control You would need to compile a litle piece of software: dellfand http://dellfand.dinglisch.net/ sudo apt-get install g++ wget http://dellfand.dinglisch.net/dellfand-0.9.tar.bz2 tar xvjf dellfand-0.9.tar.bz2 cd dellfand-0.9; make For testing purposes: root@vostro:/tmp/dellfand-0.9# ./dellfand v0.9: Fan 0 Status 1 Speed 61980 CPU Temp 31C For installing it and enabling for default sudo cp etc.default.dellfand /etc/default/dellfand sudo cp etc.init.d.dellfand /etc/init.d/dellfand sudo update-rc.d dellfand defaults sudo /etc/init.d/dellfand start With dellfand the fan in your system would cool it when the temp is higher.
Posted: 2008-03-08 09:22:00

Funny
http://www.boingboing.net/2008/03/12/unusual-home-invasio.html sigh*
Posted: 2008-03-13 18:04:00

ubuntu-np LOcal COmmunity
We are currently working on getting Ubuntu Nepal Local Community up and going. Please visit #ubuntu-np@irc.freenode.net if you happen to be Nepali linux user and like Ubuntu distribution. We are in need of Ubuntu hackers! :-) We are also working on getting ubuntu-np@lists.ubuntu.com mailing list up and going [ still in progress. Jono, I'll be looking forward to your reply! :) ] I was quiet disappointed by this talk between me and a guy I won't name regarding ISPs in Nepal. I was asking coolguy to ask his ISP to help him out in sorting out the link speed when he said :- nepbabu said: coolguy: just call them up and ask yaar. maybe they'll do something about it? coolguy said: nepbabu, they suck I have to listen jingles and wait in line to get support only to get some employee who's yawning and knows nothing and say he willl report to other senior This sort of behaviour is all over Nepali Telecom sector and not only in ISP sector but all over other sectors as I have first-hand experience with it and I believe its this kind of behaviour has to change for goodness sake! Back to Ubuntu-np. We are planning to host the website somewhere down the line and a big thanks to Gaurav and Himanshu for the head up! We'll probably use one of their hosting service and use Moinmoin, /Mediawiki and use ubuntu-np@lists.ubuntu.com as our primary community mailing list. Big thanks also goes to Jonathan "jpatrick", Lorenzo "LjL", Dennis "Seveas" and Jono "jono" Bacon!!
Posted: 2008-03-19 05:26:00

Google 2001 index
#define THIS_POST wxT("This post is boring.") It is funny (and quite hard to imagine) that in 2001 Mozilla firefox did not exist[1]. There were many things on the web that didn't exist such as digg[2], youtube[3]. Ubuntu was still nowhere to be seen[4] (except sites related to education in Africa and maybe in Mark Shuttleworth's figments). Internet explorer and Netscape navigator were the best web browser we could get on PCs :D and Microsoft did release Internet Explorer for Solaris and HP-UX. hmmm...[5]. On Linux (oh Linux! :) side of the story, Konqueror had just been released. OMG! I didn't know armadillo was called Gzilla! and good 'ol lynx and w3m was as always nice for quick browsing. In these 7 years, my Internet speed moved from 56K speed to Megabit speed (at home) but surprisingly, Debian's page[6] has remained pretty much the same since 1998. Web.archive.Borg[6] is a nice place for all these good 'ol reminiscence. Also, IPOD did not mean Apple IPOD back then ;) I was just spell-checking this post before posting and guess what? "Debian" is not in the dictionary and the suggestion is for "Lesbian" O_o This occasion also marks the Dashain and Tihar celebration for Nepalese all around the world [7]. Happy Dashain and Tihar to all. [1] http://www.google.com/search2001/search?q=firefox [2] http://www.google.com/search2001/search?q=digg [3] http://www.google.com/search2001/search?q=youtube [4] http://www.google.com/search2001/search?q=ubuntu [5] http://en.wikipedia.org/wiki/Internet_Explorer_for_UNIX [6] http://web.archive.org/web/20010712204309/www.debian.org/ [7] http://en.wikipedia.org/wiki/Dashain
Posted: 2008-10-07 01:47:00

Android

Just so that I do not forget, I need to do some reading for android and starting coding up apps for it. Its just an urge because Java is pretty cool language itself :-) and one can make a lot of productive apps using it very quickly.


Posted: 2008-10-17 14:19:00

fscking gmail!
All day i have been getting this 'unable to reach Gmail' message. Its fscking annoying!
Posted: 2008-10-27 16:42:00

error 421 postfix fscking!
My postfix log kept reporting SMTP incoming data timeout. After confirming that it was all good over at canonical's mailing list server, i started poking my ISP. Knowing that ISPs are lazy people, I tried to Google insanely with having limited success on postfix's man page. The error specifically was: Oct 28 01:40:02 timbre postfix/smtp[13260]: 7FABBEBBBE: to=<ubuntu-users@lists.ubuntu.com>, relay=lists.ubuntu.com[91.189.94.204]:25, delay=5660, delays=5358/0.01/1.1/300, dsn=4.0.0, status=deferred (host lists.ubuntu.com[91.189.94.204] said: 421 chlorine.canonical.com SMTP incoming data timeout - closing connection. (in reply to end of DATA command)) After poking around Google for an hour or so, I finally found a hint by none other than the primary author of postfix himself, Wietse Venema on postfix list; I dropped my routers MTU to 1492 promptly, restarted daemon and my postfix started delivering mail without giving me any of the error above. For a moment, I suspected that one of the router between timbre and chlorine was dropping ICMP packets because as mentioned in here, some of the broken firewall/router deny/reject ICMP packets (which have request for resizing MTU called "MTU discovery") so eventually, the request to scale down MTU wasn't being acknowledged by chlorine and bam! data timeout eventually reported by my postfix.
Posted: 2008-10-28 03:34:00

WTF!
Was reading listening to itradio when I came across expired SSL certificate that they pointed out on good 'ol F5's website :P) f5_ssl_expired f5_ssl_expired
Posted: 2008-10-30 09:48:00

Setting up Logitech quickcam e2500 for linux
Today I bought a Logitech quickcam e2500. The webcam is good looking, slim build and sports a 1.3 mega-pixel photos and a decent 640x480 VGA camera. You can look at the camera here To get it working for Linux, I used these procedures -
$ lsusb | grep Log
Bus 004 Device 002: ID 046d:089d Logitech, Inc.

I sat down couple of hours ago to make it work on my Linux box;
Couple of head banging for not remembering the module parameters and it was finally done.
The following are the steps I took to make it work -

1) Downloaded gspca source 
   * wget http://mxhaard.free.fr/spca50x/Download/gspcav1-20071224.tar.gz
   * tar -xvf gspcav1-20071224.tar.gz

2) Downloaded a patch specific to my webcam -
   * wget http://forums.quickcamteam.net/attachment.php?aid=86 -O patch.tar.gz
   * tar -xvf patch.tar.gz
   * cd gspcav1-20071224
   * patch -p1 < ../quickcamE2500.diff

3) Compiled and installed the patched kernel module -
   * cd gspcav1-20071224; 
   * make; 
   * sudo cp gspca.ko /lib/modules/2.6.24-19-generic/ubuntu/media/gspcav1/

4) Reloaded the gspca module with additional parameters -
   * sudo modprobe -r gspca;
   * sudo modprobe gspca autoexpo=0 gamma=2

5) Installed gstfakevideo for skype since it used 90% of my CPU when video was enabled. More info is available here
   * svn checkout http://gstfakevideo.googlecode.com/svn/trunk/ gstfakevideo ('subversion' package must be installed)
   * cd gstfakevideo
   * make
   * sudo make install
   * sudo mv /dev/video0 /dev/video1
   * ./gstfakevideo v4lsrc device=/dev/video1 ! ffmpegcolorspace (this will fire off skype)
(Say cheese! :>)
5) Tried each of the following -
   * xawtv (worked)
   * mplayer tv:// -tv  driver=v4l:width=352:height=288:outfmt=yv12:device=/dev/video0 (worked)
   * skype (worked after I provided the module parameters "autoexpo=0 gamma=2")
   * ekiga (worked)
   * cheese ( this didn't work for me )

Note: It will take some time for skype and ekiga to load up the image from the webcam. Be patient :) Have fun! :)
Posted: 2008-09-20 01:06:00

Ubuntu archive mirror for Nepal
We've been trying to push Ubuntu archive kindly supported by Mitra Network to the main repository. So far it looks good. The archive is up and running and one can use the packages via adding http://archive.mitra.net.np/ubuntu/ in their apt sources.list. We've been advised to wait for a while before becoming the official mirror but that should happen very soon :) So, I guess that concludes this short note for today. Oh, and a big thanks to Kabindra Shrestha and Surmandal for their role in this. They basically took it up from barebone system to rsyncing a whopping 150GB+ and devoting space for the packages. They deserve a big applaud . Thanks guys!
Posted: 2008-08-20 18:37:00

package availability for sid and ibex
http://qa.ubuntuwire.com/multidistrotools/all.html Thanks to LaserJock and Bryce on ubuntu-devel list.
Posted: 2008-08-27 06:37:00

Preparing video for Youtube
This is the procedure i used while trying to upload an AVI file (audio only) with JPG. 1) install mencoder, mplayer and ffmpeg 2) ffmpeg -i SomeFlash SomeAvi.avi 3) mplayer -dumpaudio -dumpfile SomeDumpFile SomeOriginalAvi.avi 4) mencoder mf://\*.jpg -o Final.avi -ovc lavc -mf fps=0.008 -ofps 10 -audiofile SomeDumpFile -oac copy -endpos 6:0 Now adjust fps=0.008 accordingly (repeating step 4 multiple times). For a demo of Final.avi upload to Youtube visit http://au.youtube.com/watch?v=gVYMbxMMKG0 A big thanks to sfullenwider and cbreak. Enjoy! :-)
Posted: 2008-07-02 13:00:00

Different world? :-)
Must love this article by David Dale. :)
Posted: 2008-07-07 09:01:00

trusty old dcop
I was getting sick of trying to manually seek audio in amarok and really pissed that my dell laptop didn't sport a seek multimedia key. So, as any enthusiast would do, I tried to leverage the seek function using our old trusty dcops (sorry non-KDE users! :).
Basically, all one has to in ubuntu/debian is to install 'xbindkeys' package-
$ aptitude install xbindkeys

Check for the keycode-
$ xbindkeys -mk # -h for more info
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.

--- Press "q" to stop. ---
"(Scheme function)"
    m:0x8 + c:153
    Alt + XF86AudioNext

(In the above instance, I've pressed Alt and Dell's Next button)

Then create ~/.xbindkeysrc and dump those lines from above-
$ vim ~/.xbindkeysrc
  1 # forward 10 secs 
  2 "dcop amarok player seekRelative +10"
  3     m:0x8 + c:153
  4     Alt + XF86AudioNext
  5
  6 # rewind 10 secs
  7 "dcop amarok player seekRelative -10"
  8     m:0x8 + c:144
  9     Alt + XF86AudioPrev

Then add it to autostart (when KDE session starts)-
$ vim ~/.kde/Autostart/xbindkeys
  1 #!/bin/sh
  2 /usr/bin/xbindkeys;
If one runs Gentoo, have a read through http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys Enjoy!
Posted: 2008-07-08 14:01:00

Ubuntu Nepal LoCo Hardy Heron Release Party
There was a lot of noise in #ubuntu-np yesterday (even though we were actually in a meeting :D). Everyone's glad Ubuntu Nepal LoCo managed to celebrate it's first Hardy Heron release party. The party was organised in IOE, ZeroEnergy house and everyone seemed very enthusiastic+happy (Thanks Shankar ;-) ) :) Surmandal also managed to take some more photos which is available here. Our goal is to spread Ubuntu in Nepal and help local users get up to speed in the meantime sharing vision with developers who share the vision of using Ubuntu Linux :) Let us all rejoice! It was a great success. In the meantime issue 12 of Fullcircle magazine is released. Go get your copy!
Posted: 2008-05-04 04:55:00

sshd snooping
I was reading a paper[1] which described the design of a secure L4 kernel (a wonderful paper btw) - "First, the namespace for IPC outside the current address space is global, and visible to every thread in the system. This exposes the structure of the system to all threads which need to perform such communication. This causes a few problems. First, it restricts the design of OS personalities somewhat for example, if a server is multi-threaded, the client threads must be aware of that fact. More importantly, it opens a possible covert channel between areas of the system that should be isolated." when my memory suddenly remembered the nasty sshd snooping attack[2] from a while ago which was the result of using function calls to communicate between the different sshd processes. [1] http://www.disy.cse.unsw.edu.au/theses_public/05/philipd.pdf [2] http://pentestmonkey.net/blog/sshd-snooping/
Posted: 2008-05-06 03:23:00

Trust thy debian package source!
Everytime one downloads a debian package, it has various files within it (zipped inside, try opening with ark or some such) that gives `dpkg' information on what to do about various bits and pieces of binaries/source files which are contained within the package (which could eventually be removed/installed/upgraded on the system). Those files within control/p* are a critical piece from a computer security standpoint (Really this information applies to people who are not familiar with how debian packages work. If it insults your wit, please feel free to read some latest headlines -> www.reuters.co.uk :D) Okay, what I'll iterate below is of utmost importance - Trust thy source of Debian packages before hitting - a) 'sudo aptitude install foo' (could be infected via malicious website line in the sources.list / sources.list.d) OR b) 'sudo dpkg -i bar.deb' (could be infected via malicious control/p* file within the deb file downloaded off the internet) If one downloads a virus/malware from bad sources.list/sources.list.d or a malware site [p-h]osing as debian packages, then it could do anything from installing backdoor in the system to wiping out enough files to make it unbootable (rm -rf / in the control/p* or even parted rm /dev/[s-h]db1 etc..). Hence, I recommend folks to download packages from trusted source (such as main debian repository for debian/debian-derived distribs). There has been cases in the past such as 'rm-rf'ed system from such malicious deb files. It certainly won't be the first nor the last so I feel in many ways that it is better to arm oneself with the information that every piece of debian packages that one downloads could be *possibly* infected. Also FEI, main Ubuntu repository (archive.ubuntu.com) was cracked in the past. That's scary because it could have potentially provided an avenue for malware inside the packages (yes, carried out by the crackers). Enouf now :-) I guess. Have a great weekend! (me goes shopping for a new cordless or VOIP phone; just depends which ones cheaper :-))
Posted: 2008-05-30 10:52:00

Hiphop artists
hip HipHop artists in Nepal
Posted: 2008-04-02 18:34:00

overclocking the new B4 XO laptop
Overclocking new B4 XO laptop.
Posted: 2008-04-04 04:40:00

Ubuntu Nepal.. here we come!
It feels really good that Ubuntu-np LOCO is up and running. There were many important infrastructure setup we accomplished over the ~3 weeks period and still got a bit to go like getting officially "approved" and also on top of that getting the gpg keys of the member uploaded to launchpad. Ubuntu Nepal's main wiki is serving everyone biscuits @ http://wiki.ubuntu.org.np The mailing list is up and running - ubuntu-np@lists.ubuntu.com (subscribe here first https://lists.ubuntu.com/mailman/listinfo/Ubuntu-np) Our Planet is also up - http://planet.ubuntu.org.np And our forum for all nepali ubuntu phpBBians out there - http://forum.ubuntu.org.np Let me be a little formal at this point and take sometime to thank everybody involved in it - Bibek, Himanshu, Prasanna, Subir dai (thanks dai for getting NS registration!!!!!), Hempal dia, our IRC regulars and hardcore Ubuntu users such as Webrover, Ujwal (OK he uses Debian stable like me :-] but I love Ubuntu and mostly use it nowadays compared to Debian :))) ), Bibek Sh, Shankur, Jwalanta and our great friend Neal :-) We've seen a lot of old users but new faces in #ubuntu-np these days!! Keep them coming. Here we come UBUNTU!!!!!!!!!!!!!!!!!! :-)
Posted: 2008-04-09 16:49:00

State of Ubuntu Nepal, libnepal yippie!
Ubuntu Nepal is on fire! We've got wiki entries popping up like a popcorn in the oven! heheehehehe. :-) Everyone seems to be enthusiastic and everything is moving rapidly as it should be. I guess, libnepal's not getting the "supposed" amount of attention at the moment but I am going to devote a bit of time on that from now again as well. :-) As for apt repository mirror, surmandal is going ahead with the setting up with wlink's server as it has agreed to hosting it for Nepal!! I mean this is a really cool move for everyone in Nepal. :-) I hope this all works out. yippie!
Posted: 2008-04-17 03:57:00

konsolve vs. xterm (and aterm as well)
Watch and learn: http://www.kdedevelopers.org/node/1034. Glad I've started using konsole in KDE for at least couple of months now. Before that I was a happy xfce user. :-) (Back to Gnome now :>)
On xterm:
bikal@zebra:[~] time cat /usr/share/dict/words 
 ...(((snip)))...
real    0m11.080s
user    0m0.000s
sys     0m0.056s

bikal@zebra:[~] time find /usr/src/linux/
real    0m3.759s
user    0m0.064s
sys     0m0.092s


On konsole:
bikal@zebra:[~] time cat /usr/share/dict/words
 ...(((snip)))...
real    0m2.555s
user    0m0.004s
sys     0m0.056s

bikal@zebra:[~] time find /usr/src/linux/
 ...(((snip)))...
real    0m1.136s
user    0m0.072s
sys     0m0.064s
Haven't tried aterm or gnome-terminal :-))) The only reason I prefer Konsole over gnome-terminal and others is the facility it provides and useful features such as bookmarking, schema settings and loads of others..
Posted: 2008-04-20 12:11:00

OLE Nepal [OLPC Nepal now]
OLE Nepal has been carrying on it's development since a while now. Today, I received a mail from Bryan Berry (System Engineer, OLE Nepal) [in the mailing list] regarding their ongoing efforts and the images from the deployment at 2 places schools - Bishwamitra and Bashuki in Kathmandu, Nepal :-) It was great going through the Flickr images with a hope someday that those kids will be able to study the contents in Nepali+English and become the next great kernel developer, doctors, engineers. I hope it the flickr images delights you as much as it delights me in presenting it. The mail from Bryan is also shown below for convinience. http://blog.olenepal.org/index.php/archives/272 Rabi Karmacharya wrote up a great description of the launch of OLPC at Bishwamitra and Bashuki schools laptop distribution Here is the photostream from the event: http://www.flickr.com/photos/80049722@N00/sets/72157604771101410/ xo pics : http://www.flickr.com/photos/80049722@N00/sets/72157603977140085/ Let there by penguin power in the hands of the children! :-))))
Posted: 2008-04-29 16:57:00

stuffs
Some really cool "must read" documentation on FreeBSD - the freebsd handbook and Greg Lehey's "The Complete FreeBSD" and online version is also available.
Posted: 2008-02-09 13:27:00

Good cheatsheet for linux
Heads up :) to Paras and Prasanna David. Comprehensive and huge cheatsheet for Linux.
Posted: 2008-02-11 00:53:00

the office
It just occurred to me the other day from the original brit comedy "The Office" about a real-life situation in a office. Imagine a day at office, everyone working "hard" as usual. Suddenly the fat boss [David Brent aka real-life => Ricky Gervais], shouts "Oieeeeeeeeeeee!" on top of his throat and starts doing his thingy [shown below]. What happens next? LMAO!!! [BTW, Gareth Keenan aka real-life => Mackenzie Crook should start waving at David I bet in his frying-pan-shaped hairstyle!]. I must admit I love Ricky's+Mackenzie's style of humour! ROFL! They express humour & surcasm with action rather words. Go Ricky!
Posted: 2008-02-12 18:29:00

Some power saving tips
Power saving tips for disk drive - http://www.lesswatts.org/tips/disks.php Save energy demands of your PC/Laptop/Server today! :-)
Posted: 2008-02-16 10:40:00

Google bot
Google uses different user-agent string in it's crawler to see if the site returns different content based on user-agent. Quite neat idea. :-) More @ http://www.jibble.org/news/?period=2006-04&id=1146227052
Posted: 2008-02-22 12:18:00

Nova NetPC
It's been exactly 8 days since my last post. Time passes so quickly and as they say, time and tide waits for no man [oops.. and woman, I am not a feminist otoh!]. Anyway, in this seven long days, I had the opportunity to discuss some interesting topic with my friends of which one of them was "Nova NETPC". A marvellous little device which have the following features:
	- Absolutely no open hardware and software specification available to the public.
	- Costs sub US $100 dollars [thumbs up for that].
	- Is hyped up as the next "big" cheap solution
	- Customer's data is stored on the server [yikes!]
	- Will be sold back to some tech giant/s some day. [Read: NOVA NETPC userbase could be screwed]
	- Has no documentations available to the public.
	- Anyone's got any clue how hackable* it is?		
Unlike the merits of LTSP-based system, novatium netpc is a full-fledged device in itself with on-board capability for networking, video, voice many more. The whole device is made to work on subscription model where you subscribe to the service provided by ISPs to get service for your internet, music, television etc. The netpc's website is abysmal [read: full of advertisements, SWFs and static contents], no documentations and thinks that public can get better idea of what this whole shebang is without reading the docos. You'll get better idea from other newspaper articles doing the adverts for Nova NETPC and since Google is a dictionary word, I'd love to say scroogle it. It might sound little stupid for me to say some really stupid things about such a wonderful little beastie but there are alternatives to Nova NetPC and NET PCs [Intel, HP, IBM and other major players have sub $1000 PCs in the US market] which may or may not be in-demand [according to who you ask]. Implementing LTSP with donated hardware could be the best possible low cost solution for now [until they figure out open systems that have proper system specs and documentations so that people could adapt it to suit their need] [Update: I remember one of my friend saying donated hardware is considered "harmful" electronic wastage. What a pity and a waste of wastage!] Finally, for US $110-120 range, in India, anyone will be able to buy second-hand machines that have full pirated software loaded with Microsoft Windows Vista. <grounded="nepbabu> Last update [hopefully]: An interesting read http://economist.com/specialreports/displaystory.cfm?story_id=10053304 </grounded="nepbabu>
Posted: 2008-01-07 13:10:00

w00t! Botnets?
An update on what I wrote regarding the Ddos attack on Estonia [alleged by experts to be originating from Russia]. Computerworld article dated 8/01/08 has an interesting insight in that they refer to Jose Nazario (Arbor networks) guy who said - "We don't know who is behind any of this activity, and we don't want to speculate, but you have to ask yourself, is this directed by someone higher in the political organizations, or is it merely somebody who is acting as a lone vigilante?". Tis something very analogous to my idea of the roots of Ddos [i.e., it could have been originated elsewhere]. I still don't have an answer how it could be accomplished. <bump>
Posted: 2008-01-09 15:46:00

LiveCDs for humans [ and there are no ETs ]
I was discussing with one of my irregular mate [offline mate] today regarding <mindf**k> lots of other things </mindf**k> amongst which one of them was the LiveCDs [Linux LiveCDs tbp]. Basically he didn't know that LiveCDs existed! I had a very good discussion about the merits and about how it doesn't require installation onto the hard disk. I also shared the many benefits of using an open system etc.. :-) He is an old non-techie guy who uses a Microsoft Windows. He gave me something too! He shared his knowledge of IBM and almost an entire era of 1940s - pre-1980s IT companies to which he'd think that I was "unaware" of [ that I am a n00b in his in view similarly he'd be n00b in my view regarding Linux system :-)]. It was a pleasurable discussion because I really was "unaware" of lot of the history of these IT biggies and lot of other stuffs [after all he had worked for BBC back then]. He looked interested in using Linux through LiveCD so I gave him the name of one of the friendliest Linux distribution, Ubuntu Linux which has a huge community and also told him the concept behind "swarming" or torrent so that he could use the torrent descriptors from Ubuntu website. He seemed content. :-) Finally, I had to leave so before leaving we had a brief discussion about Microsoft and it's history. He told me that when Microsoft went public in the 90s, the IPO was $10/share which the subsequent weeks spiraled up to ~$140/share. This was in the 90s. This is amazing given that Bill Gates feared the price of $20/share would be too high! :-) [Another reason fear is a killer for a man; Go on liberate yourself, don't let fear control you] Given that I am not an economist or mathematician, I'd imagine the value of Microsoft to be at least double that of today if he hadn't feared! [I do know that kernel hackers and other language lawyer pussies [read: pussycat] like to call the kernel as "Linux" and the the whole shebang [userland+kernel] as Gnu/Linux but I am used to calling it Linux and I'll use it that way. I do know that I laugh a lot also. RMS would be angry at me. I'd laugh then too. If you don't have sense of humour, screw u! :p]
Posted: 2008-01-11 03:20:00

"Be vewwy, vewwy quiet. I'm hunting wabbits." -- Elmer Fudd
Probably not worth a post :/ but, I was reading some tidbits on Wikipedia when I came across the a term called "wabbit". LMAO =) Let me say it again for the sake of Elmer => "Shhhhhhhh, be vewwwy, vewwwy quiet; I'm hunting wabbits, heheheheheheh" LMAO and also ROFL!!!!!! Here's a small wabbit [harmless] for Elmer :-]
#include "unistd.h"
int main() 
{
int p = 0;
for (; p < 10; p++)
	{
		fork();
	}
return 0;
}

Posted: 2008-01-16 14:02:00

Mr. Bacon or Monsieur Tofu?
Do you want to eat bacon or tofu tonight? Decide yourself On a more serious note, the web since yesterday has been full of Apple's latest release - "World's thinnest notebook" Ooopss! apologies. As Brian Solis of Bub.blicio.us likes to put it "Be careful, its so thin, it could give you paper cuts.". The official hardware specification of the Macbook Air shows the packages included are a whopping 60GB SSD/80GB PATA, 802.11n wireless device [backward compatible with 802.11a/b/g], Backlit fullsize keyboard with ambient light sensor, "No optical drive" [however Superdrives (a combo {cd-dvd}+rw) are available as extra purchase]. Here's the full list Anyway, I'll have to congratulate Apple on yet-another enticing call! At this point let me say Woahhhaa!. Okay Macbook Air is definitely very enticing indeed but I'll have to hold my breath and also my pocket for now. In the meantime, there's alway the little cutie EeePC. This little demon has 7" display, 8GB SSD, 802.11b/g and more. And the cost? Depends on where you are. For e.g., in Melbourne, Australia it was available for a short period for $399AU! [Ian Loxton likes to put the price as "tongue wagging marketing" :-]. In other places around Australia, EeePC is selling for $450-$500 range atm [Also important to watch out the difference in the model - 4G_Surf VS. 4G_Normal]; Give it another 3-4months. EeePC is powered by Xandros. Let that be told! Grrrrr....
Posted: 2008-01-17 05:19:00

History of BBS
Just the other day, Prasanna and myself were talking about history of BBS and it occured to me that I had already watched an 8-part (3 discs) series on history of BBS by Jason Scott Sadofsky. So as all brainwashed people do, I recommended it to him :-]. One of the important part in the documentary besides the BBS culture itself is the evolution of archiving format [AFAICR, it's in part 3 of third disc] and the eventual destruction of System Enhancements Associates [SEA]. Anyway, a turf between PKWARE [owned by Phil Katz who's dead already] and SEA [owned by Thom Henderson, his sister and few others] in which SEA alleged that PKWARE stole their source code and made an a product out of it [according to Thom Henderson, who weeped during the interview, the source of PKZIP had comments from SEA's ARC!]. BBS community users who used ARC started hammering Thom Henderson with hate mails and also the rest of the archive users in general and a lot of hatred between ensued between them. This eventually led to the formation of ZIP program and the rest as they is the history. :-) It's kind of stupid that sometimes, we all seem to do what others tell us to do. I can't blame anyone because as I could have done the same if I was into that culture. Lesson learned: Keep your brain ventilation wide open but not so open as to be polluted by people who peruse persue it just because of their own selfish needs. Also, live a liberated life. Over and out. ;-)
Posted: 2008-01-19 07:33:00

Implementing LTSP Nepal soon
Just a short update My friend daya is heading up as a lead engineer in implementing LTSP at one of the school in Sindhupalchowk, Nepal. It is being funded by HeNN [Help Nepal Network], FOSS Nepal volunteers, Save the Children [Norway] and technical support has been provided by MPP. AFAIK Daya, he's a cool bloke and a sincere hacker who's doing what others hesitate to do. I would like to congratulate him and I look forward to updates on his journal regarding LTSP implementation. :-) And the outcome of the project? I believe it is three-fold. Economics, Technological and Education. Three cheers to LTSP Team! You can read the full post update @ Foss Nepal discussion list side-note: Call it rant of whatever but I believe everyone can and would like to work on FPGAs, HPC systems, latest web frameworks, deface fucking dumbass website or even hack on latest gizmos but I rarely find people who work on these kinds of system. This is the reason I find daya to be one of the coolest hacker around in Nepal who works and proves to the world everyday that he's not some nonsense crapoholic to be taken lightly whilst maintaining a simple sense of life. My views are purely objective and and totally unrelated to subjectives of our friendship. Update: The photo provided by Daya and Prabin Gautam (aka Open_lad) is available here (Picture 11, 12 and 13 are from deployment @ Sindhupalchowk, Nepal). Also the discussion can be read in this foss-nepal discussion thread. I'll post the pictures from other deployments soon! :)
Posted: 2008-01-19 09:40:00

Baby do's and don't
Just an update from my friend ankur, newly-wed couples or pregnant woman's must-see! LMAO.
Posted: 2008-01-27 06:27:00

Help Help Help [ that's a help call; thrice]
An article in news.com.au titled "Haiti's poorest reduced to eating dirt" dated Jan 29, 2008 shows how people in Haiti, eat cookies made out of dirt! At first I was like what the but as I read, my face glued to the monitor and my heart filled with pain for these people, I couldn't stare more at the biscuit lying on my table. I guess at the end of the day, countries go at war [both internally and externally] against each other, people die, leaders are born and history written but what of these nations who don't have any choice, are they suppose to carry on like this?
Posted: 2008-01-29 15:03:00

speedup a Perl function with memoize
Just thought I would do myself heaps of favour by posting the periodic dose of snippets I have built up over the years in my code repository. :) This is a technique called memoizing in Perl which caches the function lookup. The basics of memoizing are all explained for the nitty, greedy down at CPAN along with all the things one would expect from a decent module. To get intimate with the memoizing technique, consult Wikipedia. Love Wikipedia must I say. :P Anyway, the code is nothing fancy, just a recursive Fibonacci series addition from a given value until it hits zero. However, the time it takes to complete the fib series addition here is interesting.
$ cat /proc/cpuinfo (info deemed uncessary stripped out)
processor       : 0
vendor_id       : GenuineIntel
model name      : Intel(R) Pentium(R) M processor 1.50GHz
cpu MHz         : 600.000
cache size      : 2048 KB
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx est tm2
bogomips        : 1198.27

$ time perl memoizing.pl 
Fibo of  30 => 832040
real    0m0.071s
user    0m0.048s

$ time perl unmemoizing.pl 
Fibo of  30 => 832040
real    0m2.877s
user    0m2.832s

Woahhh!!! 

However, this doesn't mean every subroutine/function in Perl has to be memoized. If you scroll down the CPAN page of Memoize.pm module, you'll be able to read some gotchas and above that you'll find other fancy pancy options that you can pass to memoize(). Have Phun!
#memoizing.pl
#!/usr/bin/perl -w
use Memoize; memoize('fib'); #comment this line and see the difference in `time` ;)
#$_=<stdin>; chomp;
print "Fibo of  30 => ",fib(30), "\n";    #fib function is already memoized
# Compute Fibonacci series
sub fib {	my $n = shift;return $n if $n < 2; fib($n-1) + fib($n-2); 

#unmemoizing.pl
#!/usr/bin/perl -w
#use Memoize; memoize('fib'); #comment this line and see the difference in `time` ;)
#$_=<stdin>; chomp;
print "Fibo of  30 => ",fib(30), "\n";    #fib function is already memoized
# Compute Fibonacci series
sub fib {	my $n = shift;return $n if $n < 2; fib($n-1) + fib($n-2); 

Posted: 2008-01-30 18:22:00

Just found this cute Mario and Luigi
How's zat for a change?
LMAO ~:-p Btw, there's an excellent game called "Super Mario Wars". The last time I used to play Mario was on 16-bit Super Nintendo Consoles (below).
Posted: 2008-01-31 01:05:00

Welcome to LiveJournal

Posted: 2007-12-02 00:00:00

Journal entry 1
Just got a journal entry up. I had a previous journal but that kind of sucked (hint: wp). I have heard good things about LJ. So give this a go as my final journal. So, let's get things rolling!
Posted: 2007-12-04 05:06:00

logjam
I feel good. Everything is upto speed. Good. :-) If ever logjam developers should access this page some day, I'd like to thank them. Drivel is another good client. You can get Logjam here and drivel here. Update: All of the clients are listed here
Posted: 2007-12-04 05:58:00

FOSS
With the way the proprietary world is heading, it's always interesting to see where FOSS is heading. I use to to be an foss advocate and a user/programmer (Well, I still am a FOSS user but sometimes i shout too much I think). Until now. Sometimes it just doesn't work out. I was looking for a IDE alternative to Microsoft VisualStudio 2008 (besides Eclipse). To my suprise, I found none that satisfied my requirement. :( Called it rant, but sometimes it just doesn't work out and I just have to load up Microsoft Windows from Vmware and use MS visualstudio from there. I just wish MonoIDE worked better and was less clunkier!. It always crashes on me. I wish I had more time to debug it. :( <sadly> Waiting for the day when Mono and .NET get more closer to each other. Till that day comes, I will have to unhappily accept VisualStudio and use it for .NET and Win32 programming. </sadly>
Posted: 2007-12-05 05:55:00

diff'ing a word document
If anyone of you (like me) ever scratched your head in search for diff'ing a word document, fear no more. :-) On my Debian machine, I installed 'catdoc' software. What it does is convert the MS word document to plain text or TeX. Then one can diff them. Action speaks louder than word - $ apt-cache search catdoc catdoc - MS-Word to TeX or plain text converter $ apt-get install catdoc ... $ catdoc a.doc > a.txt $ catdoc b.doc > b.txt $ diff -y a.txt b.txt voila! :-) Are there any better tools? Update: If it's an rtf document instead, one can use 'unrtf' software to get rtf to text format and then proceed with diff.
Posted: 2007-12-05 07:04:00

LTSP Nepal
One of my good friend Dayaram Budhathoki is heading LTSP project (Linux Terminal Server Project) in remote part of Nepal along with another LTSP guru Jwalanta Shrestha. He sent me these pictures of the LTSP implementation using Nepalinux. :) <nepbabu> daya, put the photos in wiki so i my livejournal doesn't thrash your ftp server :) <daya> nepbabu, MPP is planning for one website dedicated to ltspnepal LTSP Nepal does not yet have website but they plan to implement one very soon! :)

(In class, students listening, ohh.. thou dedicated students... ;-) Nepalinux thin clients in the background) (Jwalanta told me that they are fully functional PC but without a hard-disk and are connected to a server but thin clients they are)

(Eager to learn! :-))

(Serious at work! DND them. :-) )

(Teachers at Dhadhing district school learning Nepalinux)

(On the way to Dhading :-) )

(Bus stuck in the river. :-( )

(Carefully listening to lecture given by Amit. :-) ) You can find Daya's blog here
Posted: 2007-12-06 04:56:00

E-Library and SFD Nepal 2007
Jwalanta Shrestha, a good friend of mine maintains a photo galley over at Picasaweb and I thought I'd show few excerpts of it :-) He did his work along with other people on implementing e-library at Dang. Also, It was great to hear Foss Nepal win the Software Freedom Day 2007 competition :-) I guess all the awareness and hard work that people involved in Foss Nepal are paying off. :-)

(IT class for students of Rapti Science Campus)

(Kids looks very inquisitive [at Dang] :-) )

(Training session at Dang) You can check Jwalanta Shrestha's blog here
Posted: 2007-12-06 06:20:00

Kangaroo Farts Could Save the World
Check out this article on how to save the world by harnessing kangaroo resource (oops.. did I just say farts? hehaha) - http://www.jwharrison.com/blog/2007/12/06/kangaroo-farts-could-save-the-world/ :-)
Posted: 2007-12-07 09:17:00

Worst Band Names of 2007
Check out these band names ROFL. :-) http://www.boingboing.net/2007/12/14/worst-band-names-of.html
Posted: 2007-12-16 12:33:00

Tech conf @ Stanford
Xeni Jardin mentions over at boingboing that there's a conference at Stanford university regarding "Technology in Wartime" on January 26,2008. Some of the speakers include the coolest people in tech industry - Bruce Schneier, Neil Rowe and Nick Mathewson and many more. CPSR's website says "The goal of this non-partisan conference will be to consider the ethical implications of wartime technologies and how these technologies are likely to affect civilization in years to come. Topics will range from high tech weapons systems and internet surveillance, to privacy-enhancing technologies that aid human rights workers documenting conditions in war-torn countries and help soldiers communicate their experiences in blogs and e-mail." Also accordingly, the proceedings will be broadcasted live on the Web, and the presentations collected in book form online. Sounds interesting especially if you can make it to Stanford on Jan 26, 2008 (registration is only $50-100. bahhhhhh..) :-) Update: For students they have special prices $20 dollars (US)! For more info visit http://technologyinwartime.org/
Posted: 2007-12-16 13:13:00

Which file extension are you?
<wonders> It seems I am like a .rpm </wonders> You are .rpm  You have a nice package.  You can be useful, but your many variations sometimes make you tough to find.  You aren't apt to get jealous.
Which File Extension are You?

Posted: 2007-12-20 00:24:00

xkcd on optical illusion!
Have you tried this optical illusion yet? Requires nothing [only keyboard and eyeful of an attention] <ducks> Permanent link to this comic: http://xkcd.com/237/
Posted: 2007-12-21 23:08:00

LTSP and e-library project fotos [re-hashed :-| ]
One of my good friend Dayaram Budhathoki is heading LTSP project (Linux Terminal Server Project) in remote part of Nepal along with another LTSP guru Jwalanta Shrestha. He sent me these pictures of the LTSP implementation using Nepalinux. :-) You can find Daya's blog here

<nepbabu:foss-nepal@freenode.net>
    <nepbabu> daya, put the photos in wiki
    so i my livejournal doesn't thrash
    your ftp server :)
    <daya> nepbabu, MPP is planning for one
    website dedicated to ltspnepal

</nepbabu:foss-nepal@freenode.net>

LTSP Nepal does not yet have website but they plan to implement one very soon! :) Also, Jwalanta Shrestha, a good friend of mine maintains a photo galley over at Picasaweb and I thought I'd show few excerpts of it :-) He did his work along with other people on implementing e-library at Dang.

Finally,it was great to hear Foss Nepal win the Software Freedom Day 2007 competition :-) I guess all the awareness and hard work that people involved in Foss Nepal are paying off. :-) You can read Jwalanta Shrestha's blog here

The pictures are available here
Posted: 2007-12-24 00:39:00

Minimal Singly-linked list implementation in C#
PS - I implemented all the code here using monodevelop (a C# IDE). I did not use MS VisualStudio. I repeat, I did not use MS VisualStudio. I had no need for Winforms. And lastly, I am not a biased; If I need Winforms, I'LL USE .NET 3.5. Period.
// project created on 24/12/2007 at 5:55 AM
using System;

/* 
 * A minimal linked list implementation. 
 * Simple data model to aid understanding of singly-linked list: [node1:next==]==>[node2:next==]==>[....nodeN:next==]==>NULL
 *
 *  The furthest this code can do I believe is help you understand singly-linked list. :-)
 * It's krismas time and I am a little bit drunk so spare the bugs if any [given that
 * it was coded in ~1 hour]
 *
 */
namespace LinkedList
{
	class Node {
		public int data;
		public Node next;
		public Node(int d, Node n) {			
			this.data = d;
			this.next = n;
		}		
	}	
	class LL {	
		public Node firstnode;		
		public LL() {
				firstnode = new Node(-1,null);
		}
		
		/*
		 * Insert a value at the end of the list.
		 */
		public void insertLast(int data) {	
			Node insertion_node = new Node(data,null); //the temporary object to be inserted in the end.
			Node current_node = firstnode;
			while (current_node.next != null) {
				current_node = current_node.next;
			}			
			current_node.next = insertion_node;
			insertion_node.next = null; //nullify the last node's next pointer			
		}
		
		/*
		 * return the size of the linked list
		 */
		public int size() {
			Node thisnode = this.firstnode;			
			int counter = 0;
			while (thisnode.next !=null) {							
				thisnode = thisnode.next;
				counter++;				
			}			
			return counter;
		}
		
		/*
		 * return the 'data' (int32) at the given position 
		 */
		public int at(int position) {
			Node thisnode = this.firstnode;
			int counter = 0;
			while (thisnode.next != null) {
				if (counter == position) {
					return thisnode.next.data;
				}
				else {
					thisnode = thisnode.next;
				}
				counter++;				
			}
			if (thisnode.next == null) {
				return thisnode.next.data;
			}
			return -1;	
		}	
	}
	
	class MainClass
	{
		public static void Main(string[] args)
		{		
			LL linkedlist = new LL();			
			Console.WriteLine("Inserting some dummy values.....");
			for (int i = 0; i < 10; i++) {
				linkedlist.insertLast(i);				
			}				
			//Debugging only.
			//Console.WriteLine(linkedlist.size());			
			Console.WriteLine("Printing out the values....");
			for (int i = 0; i < linkedlist.size(); i++) {
				Console.WriteLine("At " + i + ": " + linkedlist.at(i));
			}		
		}
	}
}

Posted: 2007-12-24 07:12:00

One liner python (x,y) combination of (even,odd) pair.
One-liner python to print (x,y) combination (even, odd) pair.

#!/usr/bin/env python
# This one-liner code prints combination of (x,y) values such that (x%2==0 and y%2==1) from from 0..19 inclusive.
print [(x,y) for x in range(20) if x % 2 == 0 for y in range(20) if y % 2 == 1]


There are some interesting properties of python shown in this code.
[(x,y)...........] means the output should be a lists consisting of (x,y) pair.
for x in range(20) will print 0,1,2....19 but will only output x if it is divisible by 2.
for y in range(20) will print 0,1,2....19 but will only output y if it is not divisible by 2.
Run the code to see the output.Have phun! :-)
Posted: 2007-12-24 07:53:00

Checking for strong password
As a good Samaritan and a programmer, I wanted to make sure I chose some strong password and wanted to make sure that some of my friends did the same. So, I read up some docs[1] on cracklib and started hacking on it.

/* Check user entered password's strength based using
* cracklib (http://sourceforge.net/projects/cracklib/)
*/

#include "crack.h"
#include "stdlib.h"
#include "unistd.h"
#include "stdio.h"


#define OK 1
#define NOTOK 0


int main(int argc, char *argv[]) {
char* why;
char* passwd;
int status = NOTOK;
printf("\nPress Ctrl-D or enter an empty password to quit.\n");
while ((passwd = getpass("\nPassword: ")) != NULL && *passwd ) {
//check for user entered password with the dictionary.
if ((why = FascistCheck(passwd, CRACKLIB_DICTPATH)) != NULL) {
printf("Password is bad: %s.\n",why);
status = OK; //reset status
}
else {
printf("Nice password\n");
}
//spit out the passwd for debugging
//printf("\nYou entered: %s \n", passwd);
}
exit(status);
}


I was doing some Google and found a very nice cracklib2 bindings for Python. It should cut down the time to write the code using cracklib [but unfortunately not the speed of the code execution since Python works on VM architecture. IMO it can never beat the native implementation's (Assembly, C, C++) speed no matter what because of extra overhead associated with source->bytecode compilation and execution in a VM. If speed is of importance, I will use the C library, otherwise, I should stick with Python. That will keep me and other's happy I guess. :-)

Update: Forgot to mention, I could use psyco to speed the Python implementation up. nice. heh?

Also, since this cracklib can be used in web applications for testing user's password strength it is nicely suggested by Gary for use in Django Python framework.

[1]man cracklib FascistCheck;
Posted: 2007-12-24 19:35:00

Cyberwar and espionage
There is a piece on Sydney Morning Herald dated 24/12/07 on the future of cyberwar. Pretty interesting if you ask me. But on the contrary, I believe these kinds of war depict the real-world situation. What if the attack on Estonia was not carried out by the Russians? What if all the attacks and so forth mentioned by US, Australian, Indian and other authorities did not originate in China? I believe, you could say this is more like science fiction than reality at the moment, but there could be a possibility that these massive Gigabit/sec dos traffic could have been originated elsewhere [I do not yet have an answer to how this could be done. I'll let you all know when I do. :-)]? Or, if you can provide with an answer, that'd be awesome!
Posted: 2007-12-26 19:41:00

Shit more pleaseeeeee..
Me and one of my real-life mate were discussing about this when it just occurred to me about "shit and get money for it". Wouldn't it be nice if human feces would be used to extract methane powered automobiles, gas stove and other equipment which could then harness it and use it somehow? In this scheme, everyone benefits. I'd shit today and tomorrow morning I could use the methane in it to cook my food, drive automobiles, power my laptop .... endless possibilities. :-). Also, just like in hospitals and other blood bank today where people get money/compensation for donating blood, similarly people could be given compensation for donating their feces. Given that there's a huge energy crisis today, this could be implemented in houses of the future where there could be big storage tanks in which people's daily feces are deposited and methane gas extracted. Then whenever they need the energy, they're delivered to people's houses where they can use the "converted" energy for their daily needs. Just thought I'd mention. This is one form of sustainable method of delivering energy to ever-increasing demand for growing automobiles, electricity etc... :-)
Posted: 2007-12-27 04:11:00

LTSP Training Of Trainers [TOT]
Recently, there was a training program called LTSP TOT (Training Of Trainers) carried out by MPP, HeNN and some of the FOSS Nepal volunteers. The concept behind LTSP TOT is to motivate and give training to students regarding LTSP so that they can go out to remote parts of Nepal and implement thin clients. After they have sufficient knowledge to implement LTSP, they give training to more people; i.e., multiply as much as possible. The first induction and training was recently completed and was successful in its mission. There are loads of appreciations floating around [given that the program had about 12-14 20-25 students initially?] which I'd say rated fairly well. You can read about LTSP TOT at Jwalanta's blog. :-) Update: There are more fotos made available by Prabin over in his picasaweb.
Posted: 2007-12-30 05:41:00


« Back to the main page