Monday, September 19, 2011

see pictures saved with gnome-screenshot in order

Using gnome-screenshot you can save screenshots of specific windows in GNU/Linux.

I don't use gnome, I have sawfish as my window manager without a desktop environment, so I just bind a key like PrintScreen to "gnome-screenshot -w" to save such screenshots.

When saving screenshots in a row, you get filenames like:
Screenshot--.png

Which will probably have some spaces.
As by default the order will be something like 1 20 21 2 3, if you want to see them in a viewer like xzgv, you won't get them in the right order.

Solution:

#solution no1, using awk:
ls |sort --field-separator="-" -k 6 -n|awk 'BEGIN {dude="";} {dude = dude " \"" $0 "\""; } END {print dude}'|xargs xzgv 

#solution no2, just using the input field separator (IFS):
ls -Q | IFS="
" sort --field-separator="-" -k 6 -n|xargs xzgv

Just adjust the -k field of sort and done!

Monday, August 22, 2011

ripping music/audio CDs in linux to mp3

Check tracks info:
(/dev/scd0 will be the specific device)
cdparanoia -Q -d /dev/scd0

Make a directory for the tracks
mkdir some_cd
cd some_cd

Rip the audio tracks
cdparanoia -B

You'll get a bunch of wav files (can also use raw or aift).
Re-encode all the files in the dir to mp3:
for FILE in * ; do lame $FILE; done
("lame -b 256" will set the bit rate to 256kb/s)

Delete wav files
rm *wav

You'll end up with a bunch of mp3 files in the directory.

how change keyboard layout in GNU/Linux

To change to US American (English) Keyboard:
setxkbmap -rules xfree86 -model us -layout us

To change it to Japanese:
setxkbmap -rules xfree86 -model jp106 -layout jp

If you are behind a virtual machine in a Japanese computer, remember to first set to English Keyboard layout/input in the host OS.

music cds reading/listening linux commands

Check number of tracks and length:
(where actually specifying the drive, here scd0)

cdparanoia  -Q -d /dev/scd0

Listening from track 1 to 100... (using bash and mplayer)

mplayer -cdrom-device /dev/scd0 cdda://{1..100}


google talk with Open sound system (OSS)

google talk with Open sound system (OSS)...
It just doesn't work!
At least with the plugin for chrome, you can use the webcam and have video stream. But there's no client that will let you have voice chat...
I tried:

  • pidgin
  • yate
  • kopete
  • psi
  • empathy
well, some of them just don't support audio from the beginning. But it really sucks!

Thursday, August 18, 2011

I won a paper guitar by drinking coka cola

Coke finally gave me something back (it already gave me lots of dental caries and the dentist asked me if I've ever worked with acid because teeth are not suppose to look this way...).
I won one of these guitars!!


Gee, kinda looking forward getting it.

Tuesday, August 16, 2011

Find files ignoring a directory with the find command

I always forget this usage.
The "prune" option will ignore directories before it, so:

find .   -name dir_to_ignore -prune  -o  -name "*flv" -o -name "*avi"

Will find for every file ending with flv or avi, that is not in the dir_to_ignore directory.