Skip to main content

Posts

Showing posts from 2013

Hard Disk Recovery

My WD external hard disk wasn't getting detected by windows. Upon looking up at Disk Management in Computer Management, I found out that the disk was made unallocated. This was troublesome since it was working fine a day ago. After a few hits on Google, I came across a utility named TestDisk . It's an open source application which diagnoses hard-disks, recover data and correct disk errors. The official website describes the software as this -- TestDisk is powerful free data recovery software! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software , certain types of viruses or human error (such as accidentally deleting a Partition Table). Partition table recovery using TestDisk is really easy. TestDisk can Fix partition table, recover deleted partition Recover FAT32 boot sector from its backup Rebuild FAT12/FAT16/FAT32 boot sector Fix FAT tables Rebuild ...

Jar and Classpath

Ever tried doing this? java -cp "." -jar Sample.jar Doesn't work, does it! I found out it the hard way. I actually had to debug all the way down to logging all the classpath in the program. Java(1) 'does' spell this out. -jar Execute a program encapsulated in a JAR file. The first argument is the name of a JAR file instead of a startup class name. In order for this option to work, the manifest of the JAR file must contain a line of the form Main-Class: classname . Here, classname identifies the class having the public static void main(String[] args) method that serves as your application’s starting point. See the Jar tool reference page and the Jar trail of the Java Tutorial for information about working with Jar files and Jar-file manifests. When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored. Note that JAR files that can be run with the “java -jar” option can ...

4chan Image Spider using 'wget'

4chan is a great fun tool, where people from across the globe dump their thoughts (could be in a racist, offensive and sexual way as well). It has various boards according to various interests which includes /int/, /s/, the infamous /b/, /a/, /c/ and a lot more. 4chan image boards can also be fun at times. In this blog, I give you a tool for grabbing the images from 4chan boards. It uses a unix utility wget for downloading images automatically. Windows users might get an equivalent version from here . wget.exe -H -A '.jpg,.jpeg,.png,.gif,' -rc -Di.4cdn.org -P 4chan-pics -erobots=off http://boards.4chan.org/b/res/14479452 where, ' -P [name] ' gives it the directory name of the folder in your home folder ' -H ' Goes to outside links ' -nd ' is no-directory which won't put the images in separate folders. ' -r ' is recursive ' -A[.extension] ' tells it what extensions to download ' -D[location] ' is the server ...

cmd.Cmd module

Python has lots of surprises for it's lovers, one such pleasant one is the cmd.Cmd module .    A programmer might encounter tons of project where she might have to write a command line interpreter for his program to execute it. Typical undergrad lab. projects have tonnes of such project where one has to implement something, say for example Graph or a toy ticket reservation system. All these projects require the developer to create a command terminal which will prompt the user to write a command from some predefined set of them and then print the result in the terminal. Python provides a brilliant solution to such repreatative task in the form of a module cmd.Cmd. The best part is that the it gives the developer the freedom to do his implementation task independently to the command interpreter module. Cmd module offers tonnes of feature, some of them are -- command auto-completion auto help functions auto generated description of the command from the python docs. f...

Death by Puns : Networking Protocols

A TCP packet walks in to a bar and says “I want a beer”, barman says “you want a beer?” and TCP packet says “yes, a beer”. In high society, TCP is more welcome than UDP. At least it knows a proper handshake. A bunch of TCP packets go into a bar, until it’s overcrowded. The next day, half as many go in. A bunch of TCP packets walk into a bar. The bartender says, “Hang on just a second; I need to close the window.” When I try to send SYNs to chicks, I don’t get any ACKs. Just FINs and RSTs. IP packet with TTL=1 arrives at bar. Bartender: “Sorry can’t let you leave…and you don’t get any beer either…”. The worst part about token ring jokes is that if someone starts telling one while you are telling yours, all joking stops. The great thing about TCP jokes is that you always get them. The problem with TCP jokes is that people keep retelling them slower until you get them. I would tell some UDP jokes too but I ne...

Python script for Autoshutdown v2

This blog is an improvement to the script I mentioned in  Python Script for Autoshutdown . But soon after months to follow, my ISP has blocked pinging to internet, and since my logic was to try to ping Google servers; I had to alter my logic to use HTTP connection. I have changed the script to use HTTP instead of just pinging. This is my code in Python. As always, please feel free to suggest any improvement.