Sunday, June 1, 2008

Fun with Festival

Festival is a light weight text to speech program originally developed at The University of Edinburgh.

# from the command line
> echo "hello world" | festival --tts

# from a file
> echo "hello world" > file
> festival --tts file

Wednesday, May 28, 2008

file conversion

Open source developers have focussed a lot of energy on the plumbing. Here are some examples for manipulating file types:

# convert between video formats
> ffmpeg -i input.flv output.mpg

# convert between image formats
> convert input.png output.jpeg

# join together audio files
> sox in_1.wav in_2.wav out.wav

# remove sound from video
> mencoder -ovc copy -nosound video.avi -o video_nosound.avi
# add sound to video
> mencoder -ovc copy -audiofile soundtrack.mp3 -oac copy video_nosound.avi -o video_sound.avi

Saturday, April 5, 2008

firefox proxy

If your web browsing is restricted you can use a remote server to get round it. In the firefox network settings choose manual proxy and a port number. Then at the command line type:

> ssh -XfN -D PORT -p 22 user@server

Now when you surf the packets will be redirected through this ssh tunnel.

Sunday, March 30, 2008

Password protect grub

By default with Ubuntu the user can use grub to login with root privileges WITHOUT a password, which I don't feel comfortable with. This is how I password protected grub to prevent changing the boot process:

> grub
grub> md5crypt

Password: YOUR_PASSWORD
Encrypted: abcdef

grub> quit


Now copy the encrypted string into the start of the grub file:

> sudo vim /boot/grub/menu.lst
password --md5 abcdef
lock

After saving change the permissions to prevent other uses viewing the file:
> sudo chmod 600 /boot/grub/menu.lst

Saturday, March 29, 2008

Recover password

If you forget your login password it can be recovered through grub. At boot enter the grub menu and choose 'single'. This will get you a root command prompt. Now run 'passwd' to set a new password. Now anyone can do this if they get access to your machine so you should password protect grub. I will write how to do this later.

Saturday, March 1, 2008

Email from the command line

echo "message" | mutt -s "subject" -x address@host.com

Thursday, February 28, 2008

Passwordless ssh

It becomes a hassle hopping between servers with ssh if you have to type the password each time. To enable passwordless ssh go:

> ssh-keygen -t dsa (ENTER to skip password)
> scp ~/.ssh/id_dsa.pub user@other_server

And on the other server:
> cat ~/id_dsa.pub >> ~/.ssh/authorized_keys
> rm ~/id_dsa.pub

Now you can hop between servers without a password. I only do this for servers that I can afford to be compromised.