Microblogi: A very long article Wikipedia article on the orientation of toilet paper [7. kes klo 22:52] [V]

Lauantai, 29. lokakuuta 2011

Williams Cock o' the Walk

Käännös: [ Google ]

Kategoriat: [ Olut/Williams ]

Williams_Cock_o_the_Walk

“A classic red ale; brewed with large amounts of crystal malts, which give the beer a warm, red colour. Lots of whole hops – Cascade and Bobek – add a citrusy, hoppy aroma.”

Not bad, quite sweet and fruity/citrusy. Contains malted barley and malted wheat.

Williams Bros Brewing Co., Alloa, Scotland. 4.3% alcohol.

[ Postattu 29. lokakuuta 2011 klo 20.37 | ei kommenttia | ]

Sunnuntai, 23. lokakuuta 2011

Git Recipes

Käännös: [ Google ]

Kategoriat: [ ATK/Git ]

Here are a few recipes I use with git.

Using git log

Show which files have been modified by the commits: git log --name-status

View the successive changes for a given file: git log -p -- my_file (latest change first)

View the changes at word-level instead of line-level: git log --color-words

Make --color-words more readable with LaTeX files: add *.tex diff=tex to the repository's .git/info/attributes or to your $HOME/.gitattributes (read man gitattributes for more info on this, it supports other languages too)

Browseable Web Repository

To make an online, browsable web repository on a web server (I assume you have ssh access to it).

On the server, run:
$ mkdir some_directory
$ cd some_directory
$ git init
$ git config receive.denyCurrentBranch ignore
$ cat > .git/hooks/post-receive <<EOF
#!/bin/sh
GIT_WORK_TREE=.. git checkout -f
GIT_WORK_TREE=.. git update-server-info --force
EOF
$ chmod a+x .git/hooks/post-receive
The in the source repository, run:
$ git remote add web username@my.web.server:path/to/some_directory/.git
$ git push web master

(“username”, “my.web.server” and “path/to/” are exactly what you think they are.) Note the “.git” at the end of the path, it has to be there because git push is going to send its data into that directory.

When you run git push web master to upload the content of the source repository to the web repository, the post-receive hook checks out the latest version. The next time, you don't need to specify the “master” branch any more, simply running git push web is enough.

[ Postattu 23. lokakuuta 2011 klo 15.57 | ei kommenttia | ]

Sunnuntai, 16. lokakuuta 2011

Men in Black

Käännös: [ Google ]

Kategoriat: [ TV/Elokuvat/Men in Black ]

http://en.wikipedia.org/wiki/Men_in_Black_%28film%29

Wikipedia

Just read Wikipedia's page Men_in_Black_(film).

[ Postattu 16. lokakuuta 2011 klo 15.23 | 1 kommentti | ]

Keskiviikko, 12. lokakuuta 2011

Autofs

Käännös: [ Google ]

Kategoriat: [ ATK ]

Autofs allows to automatically mount a filesystem when changing directory to the mounting point. The process is frozen while the file system is being mounted, and then the chdir() completes and enters the root of newly mounted filesystem.

I have been using autofs for several years, at first for mounting USB sticks, but now also for SMB shares and SSHFS. It is meant to be used for command-line users, I don't doubt that modern desktop environments provide the same features for GUI users.

The following describes my setup on a Debian Squeeze; there may be a more modern way of doing things (the original setup was on a Debian Sarge). I assume that you know how to administrate a Debian system (in other words, I won't be held responsible for damaging your system if you follow those instructions without understanding what they mean).

Autofs

The first step is to install the autofs, bsdutils, coreutils, lockfile-progs, gawk (or mawk), sed and the util-linux packages (most of those are probably installed already). The wget package (and command) allows me to write concise commands below, but feel free to use any other tool to download the necessary files from my web page.

USB Automounter

This setup allows to mount automatically any USB Mass Storage device, without the need to manually configure anything (as is the case in this Debian tutorial).

Edit as root the /etc/auto.master and add the following line:

/media  /etc/auto.usb  --timeout=3

Then run the following as root:

# mkdir -p /media
# mkdir -p /var/run/usbautomount
# mkdir -p /etc/usbautomount
# wget -O /etc/usbautomount/usbautomount http://weber.fi.eu.org/software/autofs/usbautomount
# chmod 755 /etc/usbautomount/usbautomount
# wget -O /etc/udev/usbautomount.rules http://weber.fi.eu.org/software/autofs/usbautomount.rules
# cd /etc/udev/rules.d
# ln -s ../usbautomount.rules z60_usbautomount.rules
# /etc/init.d/autofs restart

You then need to edit /etc/usbautomount/usbautomount to change references to mweber to your own username, and possibly change the mounting options (see line 142 of the script). I still use latin1 as a character encoding, so I want filenames to be automatically translated into latin1 for VFAT filesystems. Other filesystems are mounted without particular options.

The idea here is that when you plug a USB Mass Storage device into the computer, udev runs the usbautomount script that creates a name based on the USB device's vendor, model, instance (in the case the physical device contains more than one USB Mass Storage device, such as multi-card readers or smartphones with internal and removable flash memory) and partition number, creates a symlink in /var/run/usbautomount that points to a directory of the same name in /media. When you access the symlink, automount creates the directory in /media and mounts the file system from the USB device to that directory.

If you chdir() out of that directory, after 3 seconds automount unmounts the filesystem. If you chdir() into the directory again, automount mounts it again. The short timeout for automatic unmounting allows to unplug the device almost immediately after cd-ing out of the mount point (provided that there is no data to be written onto the device anymore). When you unplug the device, a script (generated by usbautomount when the device was plugged in) is run to remove the symlink from /var/run/usbautomount.

The cherry on the cake of this setup is the following:

$ mkdir $HOME/mnt
$ ln -s /var/run/usbautomount $HOME/mnt/USB

This way, $HOME/mnt/USB is automatically populated with links to the devices that you plug to your computer.

SMB/CIFS shares

The smbclient and cifs-utils packages need to be installed.

Run as root:

# mkdir -p /mnt/smb

Edit as root the /etc/auto.master and add the following line:

/mnt/smb  /etc/auto.smb  --timeout=10

(/etc/auto.smb comes with the autofs package).

Run this as your regular user:

$ ln -s /mnt/smb $HOME/mnt/smb

If you have an SMB/CIFS server named "foo" containing shares called "bar" and "quux", then going into /mnt/smb/foo will mount "bar" and "quux" in /mnt/smb/foo/bar and /mnt/smb/foo/quux. Automatic unmounting will happen 10 seconds after leaving /mnt/smb/foo.

If "foo" requires credentials (login and password), you can put them in /etc/auto.smb.foo as follows:

username = my_username
password = my_password

SSHFS

SSHFS itself requires some amount of setup. I will assume in the following that the client computer is called "local" and it accesses using SSH and SSHFS a remote computer called "remote" with user "user".

First, install the sshfs package. Then you need to create an SSH key for root@client, and authorize this key for user@remote. In the end, root@local must be able to log into user@remote using an SSH key instead of a password.

Once this is working, run as root:

# mkdir -p /mnt/ssh

Then edit /etc/auto.master as root and add the line:

/mnt/ssh  /etc/auto.ssh  --timeout=10,--ghost

Then create /etc/auto.ssh and add a line that looks like this (change the "user", and "remote" as needed):

remote -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs\#user@remote\:

By default, SSHFS will mount the home directory of "user@remote" into /mnt/ssh/remote. If you need to acces another directory (e.g., /tmp), just append this path to the end of the line in /etc/auto.ssh:

remote-tmp -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs\#user@remote\:/tmp

Finally, run this as your regular user:

$ ln -s /mnt/ssh $HOME/mnt/ssh

CDROM

It just came to my mind the other day that I could automount CD and DVD as well, but I haven't thought about the details yet. I remember the feature to be very annoying in Solaris twelve years ago, where the system was mounting the CD in a directory named after the label of the CD's filesystem, and never removing this directory. After mounting a few discs, the automount directory was filled with various directories with abtruse names, and you had to guess which one contained your data (I suppose mount would have told me what I wanted to know, I don't remeber if I tried that).

[ Postattu 12. lokakuuta 2011 klo 11.49 | 3 kommenttia | ]

Maanantai, 10. lokakuuta 2011

I Shall Wear Midnight

Käännös: [ Google ]

Kategoriat: [ Kirjat/Discworld ]

ISBN: 9780552555593

© Amazon.fr

Tiffany is working as the Chalk's only witch in a climate of growing suspicion and prejudice. When the local Baron dies of poor health, she is accused of murder. She then travels to Ankh-Morpork to inform the Baron's heir, Roland, who happens to be in the city with his fiancée Letitia. On the way Tiffany is attacked by a bad-smelling fantomatic figure, the Cunning Man. In the city she meets a witch, Mrs Proust who helps her to find Roland and Letitia. Because of the Nac Mac Feegles (who follow Tiffany everywhere), they are accused of destroying a pub. Tiffany and Mrs Proust are arrested by Carrot and Angua, and locked up for their protection, as people start to resent witches. When they are released the next day, Tiffany meets Eskarina Smith who explains that the Cunning Man was, a thousand years ago, an Omnian witch-finder, who had fallen in love with a witch. That witch, however, knew how evil the Cunning Man was. She was eventually burnt to death, but as she was being burned she trapped the Cunning Man in the fire as well. The Cunning Man became a demonic spirit of pure hatred, able to corrupt other minds with suspicion and hate. Eskarina announces that the Cunning Man is coming. Tiffany and the Feegles return to the Chalk, where they find the Baron's soldiers trying to dig up the Feegle mound. She stops them, and goes to see Roland, who throws her in a dungeon. It is later learned that the Cunning Man was the cause of these actions. Tiffany however escapes and goes to see Letitia, whom she discovers is also an untrained but talented witch. She sees the Cunning Man twice while at Letitia's home, and as guests begin to arrive at Roland and Letitia's wedding, the other witches start to arrive…so that if the Cunning Man takes over her body, they can kill her. The night before the wedding, Tiffany, Roland, Letitia and Preston (a castle guard whom Tiffany has befriended) meet at one of the fields that needs to be burned to clear it of stubble; Tiffany lures the Cunning Man into the flames and defeats him.

(Shamlessly adapted from Wikipedia's I Shall Wear Midnight)

[ Postattu 10. lokakuuta 2011 klo 20.49 | 1 kommentti | ]