Posted by
Tsukasa on March 3, 2010
I have been using xmonad under unbuntu for nearly a year now (and have been VERY happy). I thought it was finally time that I share my method for configuring/setting up xmonad.
I run xmonad under gnome, this allows a lot of the magic of Ubuntu to continue working (such as network manager configuring wifi), and helps keep the amount of manual configuration down to a minimum.
To get xmonad running do the following:
#!/bin/bash
# 1. Install the required packages
sudo aptitude install xmonad libghc6-xmonad-contrib-dev dmenu dzen2 fbpanel
# 2. Modify your gnome config so that it uses xmonad instead of the gnome window manager
echo 'export WINDOW_MANAGER="/usr/bin/xmonad"' > ~/.gnomerc
gconftool-2 --type string --set /desktop/gnome/session/required_components/windowmanager xmonad
# 3. Disable the gnome-panel
REQUIRED_COMPONENTS_LIST="$(gconftool-2 --get '/desktop/gnome/session/required_components_list')"
REQUIRED_COMPONENTS_LIST="${REQUIRED_COMPONENTS_LIST/,panel/}"
gconftool-2 --set --type list --list-type string '/desktop/gnome/session/required_components_list' "${REQUIRED_COMPONENTS_LIST}"
# 4. Stop nautilus from showing the desktop (icons only)
gconftool-2 --type boolean --set /apps/nautilus/preferences/show_desktop false
# 5. Install the xmonad config files and xsessionrc file
HG_REV="86dd222345d8"
wget -O ~/.xprofile "http://tsukasa.net.au/~hg/hgdotfiles-generic/raw-file/${HG_REV}/.xprofile"
wget -O ~/.xsessionrc "http://tsukasa.net.au/~hg/hgdotfiles-generic/raw-file/${HG_REV}/.xsessionrc"
mkdir ~/.xmonad &&
wget -O ~/.xmonad/xmonad.hs "http://tsukasa.net.au/~hg/hgdotfiles-generic/raw-file/${HG_REV}/.xmonad/xmonad.hs"
Now all that is required is to log out and back in again (and pray my instructions work in your config ^^).
Posted by
Tsukasa on January 3, 2010
It is time again for me to run a Python Golf challenge… The aim? To write a python program that solves a problem in the least number of bytes (of source code).
The first of a few problems is:
Given a list of words on stdin (one per line), find the words that have the largest number of anagrams in that list.
Print all of the words that have the meet the criteria of having the largest number anagrams (One per line, in alphabetical order).
This competition has now finished. The winner was Nick Cooper at 103 bytes, with the following awesome solution:
import sys
s=sorted
o=s(sys.stdin)
r=map(s,o)
d=map(r.count,r)
for e,t in zip(o,d):print e*(max(d)==t),
Input:
caret
crate
react
trace
ester
reset
steer
terse
organ
groan
Output:
caret
crate
ester
react
reset
steer
terse
trace
Posted by
Tsukasa on August 25, 2009
Something that is starting to annoy me about some of the newer smart phone operating system (I am looking at you iPhoneOS and Android) is that when you tick the box to make your phone discoverable by Bluetooth, it does not stay discoverable. Other operating systems give you an option to switch between hidden, temporally visible or always visible.
After a bit of hacking around on the my phone (a HTC Dream), I have discovered a way to make the Bluetooth stay discoverable. These instructions require adb (the Android Developer Bridge), an a (slightly) nonstandard rom. The reasoning behind requiring the non-standard rom, is that chown under android does weird things.
Remember that this is done at your own risk.
adb remount
adb pull /system/etc/bluez/hcid.conf ./hcid.conf
sed -i'' -e 's/iscan disable/iscan enable/;s/pscan enable;/&\n\n\t\#Make the device stay discoverable for ever\n\tdiscovto 0;/' hcid.conf
adb push hcid.conf /system/etc/bluez/hcid.conf
adb shell chmod 440 /system/etc/bluez/hcid.conf
adb shell busybox chown 1002.1002 /system/etc/bluez/hcid.conf
adb remount
rm -f hcid.conf
HCID_CONFIG="$(adb shell ls /data/misc/hcid/*/config | sed -e 's/\r//g')"
adb pull "$HCID_CONFIG" hcid_config
sed -i'' -e 's/^discovto.*$/discovto 0/' hcid_config
adb push hcid_config "$HCID_CONFIG"
adb shell chmod 644 "$HCID_CONFIG"
adb shell busybox chown 1002.1002 "$HCID_CONFIG"
rm -f hcid_config
After all this is done… Don’t forget to power cycle the Bluetooth system (untick, then tick the box for Bluetooth).
Posted by
Tsukasa on July 16, 2009
Now that I have moved, I have decided to reclaim my old iBook (which I was using as my router). With this decision, I thought it would be a good idea to keep track of what I had to do to get this machine to a state where I was happy with it (and thus a mac in general).
So, here it is, for those who are interested. You might even find a few things that you had not though of performing on your mac.
More…
Posted by
Tsukasa on June 17, 2009
I have recently been playing around with the (relatively) new Google service named Latitude. This service may be either used from your mobile phone (including the Nokia S60 range) to allow you to see where your friends are located.
Something I have wanted to do with this service for a while is to use it to keep track of where I have been. Recently Google released an API to do this. The only problem with this is that your are required to change your privacy settings, effectively allowing everybody to know where you are.
This lead me on the quest to reverse engineer the data that the latitude iGoogle gadget uses to update itself. So far, I can parse the data into a set of lists once given a url to where the data is.
To obtain this url, you will need to use firebug to watch all of the requests made by the iGoogle page (with the latitude gadget loaded into that page) and look for the one that contains makeRequest. Copy this url, with all of it’s parameters to get access to the data.
I have written a small parsing library (in python) that will grab the data, and parse it out into the specified data structure. This library is available from my mercurial repository under the latitude project.
Posted by
Tsukasa on April 16, 2009
Have you ever wondered how OSX decides what email address to use when you email a contact? A lot of the time, you get to choose, but there are times when the system decides for itself… Such as when you are using iCal to send out event invitations.
There is actually a way that the system decides on which address to pick, and this is even a public API. The problem though, is that Address Book does not expose this interface to the user.
So, after some researching (to find the actual way this is implemented), I developed a small (command line) tool to change the default email address for a user. This tool, takes the form of a small python program, using the pyobjc bindings to the AddressBook framework.
The source code is avaliable from my repository in the stuff repository under the osx/addressbook/edit_default_address.py path.
You will also find in the same folder: a script to create a mutt alias file from the system address book, and a script to convert all of the phone numbers into the international format (from the Australian format).
These three programs form the basis of a good set of examples of the python objective-c bridge for the AddressBook format.
Posted by
Tsukasa on April 7, 2009
I have been complaining for the last few days about my the font that I have been using in my terminal, so I decided to actually do something about it.
What I didn’t know, was how to go about installing some nicer fonts. While talking to James about this, he suggested that I can just create a ~/.fonts directory, and place the fonts in there. A great little piece of information, that I had no idea about.
Posted by
Tsukasa on March 31, 2009
I was having problems where the sound was crackly and quiet. So the fix seems to be reload the snd_hda_intel driver (kinda annoying… but at least it works)
sudo rmmod snd_hda_intel
sudo modprobe snd_hda_intel
Posted by
Tsukasa on March 9, 2009
As some people know, I read a lot of RSS feeds. I am currently subscribed to 69 separate feeds, and this number is slowly growing.
Something that I am starting to notice, is that quite a few websites/blogs don’t give you the whole story within the RSS feed. This is quite annoying, I read a lot of things while I am mobile (read with limited Internet connectivity), so clicking on each article’s link before I leave for the train is just annoying.
I have finally gotten around to creating a (web) service that will take these said feeds, and ‘fix’ them. To do this, I take the RSS feed that is provided by the website/blog, and grab the full page that is linked from it. Then I run a xpath query over this page and dump the result of it into the the output RSS feed.
You can grab the latest version of the service from it’s development repository at http://tsukasa.net.au/~hg/feed_fixer, or you may use my installed version at http://tsukasa.net.au/feed_fixer.
Remember that I am actually using this service, so DO NOT delete any of the entries that are there.
Some features that will be coming in a future version will be the ability to have ‘hidden’ feeds (with a special key to gain access to the feed), the ability to add feeds requiring a password, the ability to add password protected trac feeds (as they decided to require user’s to have a cookie). Feature requests are welcome.
Posted by
Tsukasa on March 9, 2009
I just discovered this little gem: Stop Google.com Redirecting to Your Local Google. Now, I am sure you would be asking why I would want to stop the redirection.
My answer is quite simple… Google has a bad habit of letting the ‘local’ google page lag behind the US version, meaning things like latitude don’t work on google.com.au.