anujbhatt.com


home / blog / undergrad stuff

Tweaks that do the trick!

NOTE All code provided here is on a "AS IS" basis. I, as author or coauthor, do not take responsibility for the effect this code has on your machine. All code has been tested prior to its upload. However, it's not been tested exhaustively. Use at your own desire.

red (pronounced "ready"): An attempt.

View source(pretty printed) -- Plain

After reading this and hearing one of the Principal Architect of Windows talk on campus, I just sat in the lab and came up with this in the hope of getting somewhere. On the course, I obviously realized some things which weren't clear at first and well that their product is just that, a product! And cannot be a script that some CS student came up with in half an hour! So from what I've heard: Vista pages, big time! Also, the attached device vs disk page time needs to be known before actually paging to the device, or does it already know that it's flash memory? Plus there's the whole encryption thing that happens before the page. You can read more about it on the aforementioned wiki page. Anyway, this script works pretty much the same on linux if you want to use a flash drive as a swap space. Really simple - some standard commands put in the form of a script! Sample session is shown below:

anuj@slackbot:~/src/python$ su
Password: 
root@slackbot:/home/anuj/src/python# ./red -m
Detected device /media/PHOENIX  with available space 3102940
Proceed? (y/n)y
Creating swap space on /media/PHOENIX
Too much space available, using 1000
1000+0 records in
1000+0 records out
1024000 bytes (1.0 MB) copied, 0.0357275 s, 28.7 MB/s
Setting up swapspace version 1, size = 1019 kB
no label, UUID=e5469591-fe8a-4e44-bf1b-4ebc1cef37bf
root@slackbot:/home/anuj/src/python# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/sda6                               partition       6140920 34764   -1
/media/PHOENIX/swap                     file            992     0       -4
root@slackbot:/home/anuj/src/python# ./red -h

red: A script that tries to emulate what ReadyBoost does (but not quite).

RUNNING
        #./red [-mrh]
OPTIONS
        m: make cache on attached device
        r: remove cache on attached device
        h: help (This message will be printed again)
root@slackbot:/home/anuj/src/python# ./red -r
Removing cache/swap space from  /media/PHOENIX/swap
Done removing /media/PHOENIX/swap
root@slackbot:/home/anuj/src/python# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/sda6                               partition       6140920 34764   -1

apt-o: The "oblivious" tweak.

View source(pretty printed) -- Plain

We all know of apt-get and apt-cache. Having used Fedora and living in the yum world, I wasn't aware of which command belonged to apt-get or apt-cache specifically. Thus, apt-o. Now you don't need to know which verb command like "search", "install" or "update" belong to what apt-*? the syntax simply becomes: $ apt-o search xmms or $ apt-o update and so on. Srichand (of Java-GNOME fame) further tweaked the code to get rid of the things which were not required and added those that he thought were.

To install: chmod +x apt-o -> su -> mv apt-o /bin/

get-servers.py

This is very much work-in-progress. It gives you a list of sorted servers based on the round trip time from your system to them. get-servers.py, as of now, probes PlanetLab nodes (320 servers distributed across the globe) and returns the sorted list.
Read the PDF for more details. Read: PDF. Download will be made available soon.

Automated Tomcat installation for network-wide systems.

Something Srichand and I wrote back in 6th sem (I think). Was used for "Java/CGI Lab" at MSRIT. Since going to each system and installing it manually would be cumbersome, this shell script was written.
Download gz.