2010年1月26日 星期二

Split MP3 in CLI on Arch Linux

1. install mp3splt, utility for mp3/ogg splitting without decoding

sudo pacman -S mp3splt

2. usage

mp3splt input_file begin_time end_time -o output_file

time format: minutes.seconds[.hundredths]

2010年1月7日 星期四

Device Number Swap During Each Reboot on Arch Linux

to specify loading order of modules in /etc/rc.conf is not working

solution: write custom udev rules

1. get a list of all the attributes of a device

udevadm info -a -p $(udevadm info -q path -n /dev/video0)

first block of the result

looking at device '/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/video4linux/video0':
KERNEL=="video0"
SUBSYSTEM=="video4linux"
DRIVER==""
ATTR{name}=="Logitech QuickCam Zoom"
ATTR{index}=="0"
ATTR{button}=="0"

2. create rules in /etc/udev/rules.d

vi /etc/udev/rules.d/10-local.rules
--

KERNEL=="video*" ATTR{name}=="Logitech QuickCam Zoom", SYMLINK+="webcam"
KERNEL=="video*" ATTR{name}=="saa7133*", SYMLINK+="tvcard"

10 is the number in sequence
* is wildcard character

3. the symbolic links, /dev/webcam and /dev/tvcard will be created and linked to the corrrect devices when loaded udev rules so you can use soft links instead

Sync File with Rsync between Windows and Arch Linux

1. install rsync on both sides

windows version of rsync is called cwRsync, can be download from http://www.itefix.no/i2/node/10650

2. add each module with the below format to /etc/rsyncd.conf on linux server side

[share]
# comment = Private Share
path = /home/share
# read only = yes
# list = yes
# hosts allow = 192.168.1.0/24
uid = nobody
gid = nobody
# auth users = username
# secrets file = /etc/rsyncd.secrets

3. auth users is read from secrets file

vi /etc/rsyncd.secrets
--

username:password

4. start rsync daemon

/etc/rc.d/rsyncd start

5. test client connection

"C:\Program Files\cwRsync\bin\rsync.exe" username@source_ip::share

6. start synchronizing command from windows client side

"C:\Program Files\cwRsync\bin\rsync.exe" -rt --delete source_ip::share /cygdrive/c/destination

-a, --archive # archive mode; equals -rlptgoD (no -H,-A,-X)
-r, --recursive # recurse into directories
-t, --times # preserve modification times
--delete #delete extraneous files from destination dirs

/cygdrive/c/destination is the destination format for cwrsync