Wednesday, February 21, 2007

Ubuntu hack for waking up your monitor

Sometimes, when I close the lid of my Dell E1505 laptop and open it again, the monitor doesn't resume and stays black instead. Today, I discovered a little hack to get the monitor working again instead of just doing a hard reboot. Press [Fn] + [Esc / Stand By] which suspends the computer, close the lid, open it, and bam...the monitor works and it decreases the chances of corrupt system files.

Wednesday, February 14, 2007

Google Pages Static Link rewriter script

On my Google Pages site, the links to my uploaded files suddenly stopped working. They changed from http://<myusername>.googlepages.com/theFile.ext to http://pages.google.com/-/static_files/theFile.ext where they would give me a 404 Not Found Error. This script is devoted to changing the links back so I can access my files.


// ==UserScript==
// @name Google Pages Static Files
// @description Rewrite "static files" on GooglePages to point to correct locations
// @include http://*.googlepages.com/*
// @version 0.1
// ==/UserScript==


//Get googlepages user to use in rewriting the links
var user = window.location.href.split(".")[0].replace("http://", "");


window.addEventListener('load',
function() {
//Use XPath to find all <a> elements with href attrib
var links = document.evaluate('//a[@href]',document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);


//Rewrite all links with "http://pages.google.com/-/static_files" to <user>.googlepages.com
for (i = 0; i < links.snapshotLength; i++) {
if ( links.snapshotItem(i).href.indexOf("http://pages.google.com/-/static_files") != -1 )
links.snapshotItem(i).href = links.snapshotItem(i).href.replace("pages.google.com/-/static_files", user + ".googlepages.com");
}
}, true);

Install Google Pages Static Files script (userscripts.org | mirror)

Saturday, February 3, 2007

Windows Live Mail Autofill script

Firefox 2 apparently can't fill in the username/password on the Windows Live Mail sign-in page so I wrote a short greasemonkey script to do so.

here is the source:
// ==UserScript==
// @name Windows Live Sign In
// @description Automatically sign in to Windows Live Mail cause Firefox can't
// @include http://login.live.com/*
// @include https://login.live.com/*
// @version 0.1
// ==/UserScript==

//add event listener to call my anonymous function after the page loads
window.addEventListener('load',
function() {
//Get email address box and fill it
document.getElementById("i0116").value = "YOUR_USERNAME";

//Get password box and fill it
document.getElementById("i0118").value = "YOUR_PASSWORD";
}, true);


Install Windows Live Mail Autofill script (from userscripts.org)
Install Windows Live Mail Autofill script (from mirror -- if userscripts.org is down)

To get the script to work, change the values for YOUR_USERNAME and YOUR_PASSWORD to their correct values. Then go to mail.live.com and test it out