"; */ ?>


21
Aug 10

Making Git to Add Empty Directories

Since git is a “content” based SCM, and empty directories by git are not considered to be content [ which is arguable ], the only way to add them is to add “.gitignore” to every empty directory.

That may sound like a weird task after each time you create a Grails / Rails / Spring Roo / … project, since there are going to be many empty directories right from start.

To ease the pain, here is an alias you can add to your “.bashrc” to use before “git add .”:

# add '.gitignore' to all the empty dirs
alias ged='for i in $(find . -type d -regex ``./[^.].*'' -empty); do touch $i"/.gitignore"; done;'

one liner author: justinfrench.com


20
Aug 10

Connect to Wireless Network at Startup

Assuming WPA/WPA2 security is used, first thing to do is to get a hash/hex of the password. Below “myssid” is the wireless network’s SSID, and “mypassword” is the password for this network.

Step 1 Generate a WPA password hash to be used later when setting up network interfaces:

$ wpa_passphrase myssid
# reading passphrase from stdin
mypassword
network={
	ssid="myssid"
	#psk="mypassword"
	psk=2f0568b3492812bd56b946dbaf3fd7dd669b9a4602a09aa6462ff057949b025c
}

Step 2 Configure a wireless network interface using the password hash from Step 1:

$ vi /etc/network/interfaces
   auto wlan0
 
   # configuring a static IP
 
   iface wlan0 inet static
   address 192.168.0.34
   gateway 192.168.0.1
   network  192.168.0.0
   broadcast 192.168.0.255
   netmask 255.255.255.0
 
   #  OR if static IP is not needed ignore above 6 lines and uncomment the one below
   #  iface wlan0 inet dhcp   
 
   # configure WPA/WPA2 security
   wpa-ssid myssid
   wpa-psk 2f0568b3492812bd56b946dbaf3fd7dd669b9a4602a09aa6462ff057949b025c

16
Aug 10

Git: Specify SSH Port

On the client side add “host” and “port” entries into “~/.ssh/config”, git will obey:

$ cat ~/.ssh/config 
host reposerver.com 
port 123

15
Aug 10

Set Hudson Home Directory

The easiest way is to:

sudo vi /etc/default/hudson

and change:

# hudson home location
HUDSON_HOME=/home/hudson

But, of course, it would be cool to just drive it from the shell’s ENV variable, which does not work at the moment of writing: hence the above “certain way” to do it.


09
Aug 10

Website Root “index.php” is not Executed

If mythtv and apache server are installed on the same box, beware of the evil trick:
mythtv is going to modify “/etc/apache2/sites-enabled/000-default” and inject it with “DirectoryIndex mythweb” after each ‘VirtualHost’:

<VirtualHost *:80>
    DirectoryIndex mythweb
        ServerName site.com
        ... ... ...

their (mythtv’s) DirectoryIndex does not have “index.php” as one of the entries, that means that the root of the website will not display, and instead an “Index Of” and directory listing will be displayed.

Removing “DirectoryIndex mythweb” fixes the problem (or you can edit mythweb’s directory index, that works too):

<VirtualHost *:80>
    #DirectoryIndex mythweb
        ServerName site.com
        ... ... ...