Author Archives: slopjong

Arch Linux: hostname moved

There was some confusion about the hostname tool which moved from net-tools to coreutils in June and finally it’s somewhere else since August 19th.

If you were wondering why hostname disappeared on your system and everything relying on it like my oh-my-zsh completion script throwing an error like this since then:

~/.oh-my-zsh/lib/completion.zsh:37: command not found: hostname

you should get the inetutils package with

sudo pacman -S inetutils

Update (25.8.2011):

I’m on testing. If you’re not you should find hostname in the net-tools package.

Update (6.10.2011):

hostname is definitely owned by inetutils.

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Unmute the sound card using the ALSA utils

On Arch Linux all the channels are mute by default. To unmute your sound card you can do it manually in the ncurses-gui-based alsamixer of the alsa-utils package which looks like shown on the following picture.

MM means that the channel is muted wheras OO marks it to be unmuted. The vertical bars visualize the volume which can be turned up and down with the up and down cursor keys. The Master and PCM channels need to get unmuted to hear some sound from your computer.

The same job can be done with amixer with the sound card number, the channel and the volume controls as arguments.

amixer set -c 0 Master 25 unmute
amixer set -c 0 PCM 25 unmute

Each sound card is enumerated, the first is 0, the second is 1 and so forth. To find out the appropriate number of a card the declaration can be found out by executing aplay -l.

➜  ~  aplay -l                                                              [0]
**** List of PLAYBACK Hardware Devices ****
card 0: I82801CAICH3 [Intel 82801CA-ICH3], device 0: Intel ICH [Intel 82801CA-ICH3]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

The settings are stored in /var/lib/alsa/asound.state, to reload them after a reboot, the alsa daemon can be added in your /etc/rc.conf (on distributions not following the bsd style the system configuration file might differ).

...
DAEMONS=(... @alsa ...)
...

The @ symbol means that the daemon is started in the background which speeds up the boot time.

Other useful commands can be found here:
http://slopjong.de/2009/01/25/useful-mac-commands

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Create an empty git branch

If a new git branch is created the code base is the same as in the master branch but sometimes you want to create an empty git branch without any ancestors.

Scott Chacon shows in The Git Community Book how this is done.

The trick is that no matter in what branch you are currently you just need to set the HEAD reference to your desired branch name and deleting the old git index.

From the master branch (or any other) you execute the following commands.

git symbolic-ref HEAD refs/heads/playground
rm .git/index
git clean -fdx 

In this example playground will be the new empty git branch. Adapt the reference refs/heads/playground to whatever you want it to be, e.g. refs/heads/your-new-branch.

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Installing python modules in your home

If you are working on a computer where you need python modules that are not installed and you haven’t enough privileges you can install them in your home folder following these instructions:

cd lxml-2.3
python setup.py build
python setup.py install --home=~

In this example I’m compiling the lxml source. In the third line the setup script creates the directory structure ~/lib/python (notice that you just gave it ~ as the home option) and places the lxml module inside.

As a last step you need to add ~/lib/python to the path list set in the PYTHONPATH variable in your ~/.bashrc and if it doesn’t exist, define it.

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Download files recursively with wget

With wget you can download files directly in a shell. If you want to download a whole site, known as downloading recursively, you can set the r option.

wget -r http://inkscape.gristle.org

By default wget respects the robots file and thus only downloads the non-private files. The protocol of the robots exclusion standard is pure advisory, this means that the robots.txt contains rules that a search engine or other robots are not allowed to access certain files but they might ignore them.

Wget can be adviced to ignore that rules and thus it downloads the private files anyway. Set the e option as shown next.

wget -e robots=off -r http://inkscape.gristle.org

Other useful commands can be found here:
http://slopjong.de/2009/01/25/useful-mac-commands

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare