Notes on Preventing Screen Blanking
Here are a few notes I've made on keeping the the screen from blanking in linux. I generally am using Ratpoison (and sometimes just the console), so these are notes on how to disable screen blanking in X and console situations, not the higher-level GNOME or KDE screensaver. I've come up with a configuration that works to keep my screen from ever turning off, but I don't have an in-depth understanding of exactly what's being done. Some of this may be redundant.
Shortcut Script for Sprunge Pastebin
I discovered the scripting-friendly pastebin http://sprunge.us a few days ago via One Thing Well. It's extremely convenient to use, but in my laziness I've tried to make it even easier. Here is a script that will upload to sprunge and return the URL. It accepts piped data, STDIN redirection, filenames as arguments, and text strings as arguments. EDIT: while using the script, I just realized that using either form of STDIN input (pipe or redirection) will treat tabs as spaces. While this will occasionally break code, it will almost always make it less legible. So, if you need to preserve tab whitespace, I suggest using a filename as an argument to the script (e.g. sprunge myscript.txt). (Click "show source")
Identifying a Program’s Package in Debian
If you need to discover from which package a particular program came from, you can use this command (note that that is a capital "S"):
dpkg -S /usr/bin/file_i_am_curious_about
Here's an example:
james@tv:~$ dpkg -S /usr/bin/sensible-browser debianutils: /usr/bin/sensible-browser
This was necessary because I apparently deleted /usr/bin/sensible-browser (which is a script that determines which web browser should be the default). To replace it, I needed to know the original package name, which turned out to be debianutils. From there it was a simple matter to do:
sudo apt-get install --reinstall debianutils
Changing Debian’s sensible-editor
Debian uses the symlink /usr/bin/sensible-editor to point to the default text editor to use. This is controlled by the Debian Alternatives system, which will work automatically if you want it to. If, however, you want to change the auto-selected "sensible editor", you can do so with this command:
sudo update-alternatives --config editor
This will let you select one of your installed text editors from a list that will look something like this:
There are 5 alternatives which provide `editor'.
Selection Alternative
-----------------------------------------------
1 /bin/ed
+ 2 /bin/nano
3 /usr/bin/vim.tiny
4 /usr/bin/mcedit-debian
* 5 /usr/bin/vim.basic
Press enter to keep the default[*], or type selection number:
The "+" indicates the editor that would be selected if Debian had to choose, the "*" indicates your current choice.
Debian also maintains symlinks for sensible-browser and sensible-pager. You can change those easily as well:
sudo update-alternatives --config x-www-browser sudo update-alternatives --config pager
If you find that your favorite program is not included in the list (most likely because it wasn't installed from a .deb package), you can add it like so:
sudo update-alternatives --install x-www-browser x-www-browser /usr/local/src/firefox/firefox 900
In English, this means install into the category x-www-browser, using the symlink named x-www-browser (found in /etc/alternatives), which points to the binary at /usr/local/src/firefox/firefox, and give it a numerical priority of 900. The priority determines which program Debian would select if set to auto. The largest number wins. This is how I added firefox into the list of potential sensible-browser selections.
Keyboard Hotkeys with Debian Lenny
Here are some notes on assigning functions to those special keys that come on so many keyboards. My Gateway SK-9920 has 12 of these hotkeys: volume up, down, and mute; play, stop, next, and last track; internet, help, mail, shopping cart (?), and back (presumably). I don't even know what the creators of this keyboard envisioned for the "shopping cart" key. Often these keys aren't recognized out-of-the-box in Windows, much less in Linux.
Like usual, there are almost certainly specific GNOME or KDE tools to accomplish this goal. Since I'm not running those, however, I'll stick to tools available in almost any X.Org environment (I happen to be using Ratpoison).
Support EFF: Play Video Games
For three more days you can buy a bundle of 5 indie video games, and you can pay whatever you want. Furthermore, you can designate where your money goes, between the five game developers, EFF (the Electronic Frontier Foundation), and the Childs Play charity (video games for hospitals). Also, all of the games are cross platform; linux, mac, and windows.
The games are:
You can buy the bundle here: http://www.wolfire.com/humble
Install Google Chrome in Debian Lenny
This is simple.
First, get the package
Go to http://www.google.com/chrome/eula.html and select the 32-bit .deb for Debian/Ubuntu, then click "Accept and Install". This will download google-chrome-beta_current_i386.deb.
Optional: Prevent Chrome from adding the Google repository
If you want Chrome to keep itself up-to-date, don't do this step. However, if you just want to check Chrome out without changing too much, you might want to type the following command at the command line:
Using ls to Show Directory Size – Updated & Explained
Note - I've written about this before (here). In my opinion, this is a vast improvement over that earlier version.
This title of this post is not entirely accurate. The post is actually about a script that will list files and directories in the same format as ls -l (the "long listing" format of the ls command), except it will correctly report the size of directories (and all of the files within them). Technically, it is actually in the format of ls -lhL.
This is functionally very different than the output of ls. Typically ls lists the size of directories not including their contents. This produces a very small number, which is the amount of disk space the directory's meta-data takes up (i.e. the names of files within the directory). Here is an example:
ls -lhL
total 116K drwxr-x--- 1 james users 44K 2010-04-22 17:21 movies drwxr-x--- 1 james users 48K 2010-04-03 22:22 music drwxr-x--- 1 james users 0 2009-12-11 16:20 photos drwxr-x--- 1 james users 4.0K 2009-12-13 22:36 data drwxr-x--- 1 james users 20K 2010-04-27 00:56 tv
Change Super Contacts Icon on the Palm Pre
I doubt many people will be searching for this post...
I like the Super Contacts app for the Palm Pre, and I decided to put it in the quicklaunch dock instead of Palm's default Contacts app. The only problem with this is that the Super Contacts app is really ugly (my apologies, guys-who-made-it, I admit I'm shallow). Here's what I did to replace it with Palm's Contacts icon.
Disable the New Google Layout
EDIT (8.5.2010) - No longer works. I give up, Google. The new interface is worse, but I suppose I'll get over it.
EDIT - This method no longer works. Google has updated their Labs search to use the new layout. Instead, you can use this URL to keep the old-fashioned Google:
http://www.google.com/webhp?hl=all
I saw the new Google search results page layout for the first time tonight. I then googled "turn off new google layout". I suppose I don't handle change very well. If you hate the new Google layout too, here's how to fix it: