Wednesday, December 27, 2006

orkut hacks

You should download and install Firefox 2 and then use the fireBug extension to run these javaScripts. Trust me, it is MUCH better than pasting it all in the addressBar. Moreover, fireFox is a much better browser and you shouldn't be using internetExplorer anyway.

For those who aren't using fireBug, remove all the lineBreaks from the code and put "javascript:" before it. For example, the country hiding script should become something like this:

javascript:var alpha=document.createElement('option'); alpha.text="beta"; document.getElementById("country").add(alpha, null);



scrapBook flooding script

Run this script and then let your browser run for some time, like three minutes or so (in three minutes it will post 19 scraps. you wouldn't want orkut to recognise it as a script and temporarily block your account, would you? that's why it waits for 10 seconds before posting each scrap). It will keep posting scraps during that time.

var epsilon=1;
document.forms[0].target="omicron";
document.forms[1].target="omicron";
document.forms[2].target="omicron";
document.forms[3].target="omicron";
var beta=document.getElementById('scrapText');
var gamma=beta.value;
function chi()
{
        beta.value=gamma+epsilon;
        submitForm(document.getElementById('b2'), 'submit', '');
        epsilon++;
}
chi();
void(setInterval("chi()", 10000));


write each letter in different colours (dark colours only)

Write something in the message box and then run this script. Due to orkut's limitation of 1024 chars per scrap, you can only post 129 (though try to keep it at 128, to be safe) characters like this (the colour tags also count as characters). I also added a confirmation alert ;)

var darkcolours = [ "blue", "green", "maroon", "navy", "olive", "purple", "teal" ]
var beta=document.getElementById('scrapText');
var gamma=beta.value;
beta.value="";
var epsilon=0;
var chi=gamma.length;
var upsilon=1;
for ( ; epsilon < chi ; epsilon++ ) {
   if ( chi > 129 ) {
      alert('orkut limits the number of charachters in a scrap to 1024. \
Since the colour tags are also counted in the characters, \
the maximum characters that you can have in the original \
message is 128. orkut truncates rest of the characters, \
leaving with a broken message. Please shorten your message \
and try again.' );
      beta.value=gamma;
      upsilon=0;
      break; }
   var x = epsilon % 7;
   beta.value=beta.value+"["+darkcolours[x]+"]"+gamma[epsilon]; }
if ( upsilon == 1 ) { alert('Script completed successfully. Now click on "submit".'); }


write each letter in different colours (all colours)

Similar to the previous one, but has all colours. Note that some of the colours are difficult to see on the background that orkut uses

var colours = [ "aqua", "blue", "fuchsia", "gold", "gray", "green",
                "lime", "maroon", "navy", "olive", "orange", "pink",
                "purple", "red", "silver", "teal", "violet", "yellow" ]
var beta=document.getElementById('scrapText');
var gamma=beta.value;
beta.value="";
var epsilon=0;
var chi=gamma.length;
var upsilon=1;
for ( ; epsilon < chi ; epsilon++ ) {
   if ( chi > 129 ) {
      alert('orkut limits the number of charachters in a scrap to 1024. \
Since the colour tags are also counted in the characters, \
the maximum characters that you can have in the original \
message is 128. orkut truncates rest of the characters, \
leaving with a broken message. Please shorten your message \
and try again.' );
      beta.value=gamma;
      upsilon=0;
      break; }
   var x = epsilon % 18;
   beta.value=beta.value+"["+colours[x]+"]"+gamma[epsilon]; }
if ( upsilon == 1 ) { alert('Script completed successfully. Now click on "submit".'); }


hide country

orkut forces its users to choose a country. But using this small hack, you can hide the country. Note that it still isn't possible (rather I haven't been able to figure out a way ;) ) to set the country to something other than what orkut allows you to. You can only hide it. Run this script in the "edit profile" page and then select "beta" as the country

var alpha=document.createElement('option');
alpha.text="beta";
document.getElementById("country").add(alpha, null);

Update (December 28, 2006):

Due to some changes in orkut, the scrapBook flooding script DOES NOT WORK. I'm working on a fix

Update (January 1, 2006):

I was finally able to fix the scrapBook flooding script! YAY!!!

Sunday, October 22, 2006

Extra Keys

Ever wanted to use those extra keys (like volume, Internet etc.) on your keybord? Well, there are many ways to do this. The easy way (KDE) : Open the Control Center, go to Regional and Accessibility -> Keyboard Layout and choose your keyboard from the list. The hard way: Use this if your keyboard isn't listed there or you dont use KDE (there IS an easy way in GNOME too, but since I dont use it, I dont know it). Open up a terminal and run "xev" in it. Press the key you want to use and carefully note the keycode displayed on the terminal. Now, use "xmodmap" to set the key to a Keysym. For example, let's say you opened xev and pressed the "Volume +" key, and got this output:

KeymapNotify event, serial 31, synthetic NO, window 0x0,
keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
       0   0   1   0   0   0   0   0   0   0   0   0   0   0   0   0

KeyRelease event, serial 31, synthetic NO, window 0x2c00001,
root 0x44, subw 0x0, time 1901594635, (767,132), root:(771,602),
state 0x0, keycode 144 (keysym 0x1008ff4a, XF86LaunchA), same_screen YES,
XLookupString gives 0 bytes:
Note the keycode. Now, lets say you want to set the Keysym of key 144 to XF86AudioRaiseVolume (you can find more Keysyms in /usr/X11R6/lib/X11/XKeysymDB (debian) or /usr/share/X11/XKeysymDB (fedora)). The following command will set the "Volume +" key to raise the volume (on KDE, this launches kmix and then raises the volume, with a huge dialog (which lasts for about 0.5 seconds) telling you the current volume):
# xmodmap -e "keycode 144 = XF86AudioRaiseVolume"
If you dont want the huge dialog, then you can use the panel's volume setter to use the key (set it's keysym to something arbitary like XF86Launch0) to increase the volume.

Keyboard LEDs

Ever made a script which runs in background, but you want it to tell you the status every now and then? Most likely, you'll resort to emailing the status to yourself. But, emailing isn't really convinient when all you wanna know is if it is on or not or something like that. Something that is far more convinient is setting the keyboard LEDs. The program which sets the keyboard LEDs is "setleds". You have an option of setting only the LEDs and not the flags (capslock, numlock etc.). However, I've not been able to find a way to actually toggle the flags when running X. Moreover, this requires you to set UID on the setleds binary (or run it as root in any other way). For example, to the set the numlock LED to on, run the following command:

# setleds -L +num < /dev/console
You can have a look at my script which gives an example of how to use this program in scripts (this script blinks the keyboard LEDs in the given sequence or randomly).