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.

Sunday, August 7, 2011

get/backup a user's tweets by bash

A shell script to download all the tweets of some user to a text file.

Put the contents of this file to a file called get_tweets.sh for example.
Then do "chmod +x get_tweets.sh"
And follow the usage instructions.
#!/bin/bash
#written by rikijpn
#use me like this:
#get_tweets.sh $SOME_USER
#or replace the USERNAME variable for the name of the wanted user
#get_tweets.sh

if [ ! -z $1 ] ;then
    USERNAME=$1
else
    USERNAME=linuxquestions #any default user name you want
fi
URL="http://twitter.com/$USERNAME?page="
FILE_TO_SAVE="tweets.txt"
TEMP_PAGE=`date +%d%m%H%M%S`.txt

printf "\n" > $FILE_TO_SAVE

for PAGE_NUMBER in {1..1000}; do 
    echo "getting page number $PAGE_NUMBER..."
    wget -O $TEMP_PAGE "$URL""$PAGE_NUMBER" 2>/dev/null;
    RELEVANT_LINES_NUMBER=`grep -e 'entry-content' -e 'timestamp' $TEMP_PAGE|wc -l`
    if [ $RELEVANT_LINES_NUMBER -lt 1 ] ; then  break; fi
    grep -e 'entry-content' -e 'timestamp' $TEMP_PAGE |
    sed \
 -e 's,.*<span class="entry-content">,,g' \
 -e 's,</span>,,g' \
 -e 's,.*<span class="published timestamp" data="{time:,,g' \
 -e "s/'//g" \
 -e 's/}">/ --> /g' \
 -e 's/<a.[^>]*>\(.[^<]*\)<\/a>/\1/g' \
 -e 's/^.*<span class="shared-content">/<RETWEET>/g' \
 -e 's/<\/a>/ in local time\n/g' >>$FILE_TO_SAVE
    sleep 5
done

rm $TEMP_PAGE
echo "all pages fetched"
exit 0

It differences "retweets", and outputs the date so you can tell when was it posted.

You can read it at my personal webpage as well.

Welcome/self introduction party of my company

25 years old, male.
I'm dancing to this song:



The purpose of this party, to meet the managers, let some impression, and thus making work friendlier/easier...
Well, it's 5 of us dancing to this so it shouldn't be that embarrassing(?).