2010年12月22日 星期三

Home & End don't work when login to OpenSUSE 11.2 with Putty

solution is to edit /etc/inputrc

136c136
< $if term=xterm
---
> #$if term=xterm
169c169
< $else
---
> #$else
181c181
< $endif
---
> #$endif

Start services at boot on OpenSUSE

start a service

insserv <service>

stop a service from starting

insserv <service>

to see in which runlevels a service script is invoked

chkconfig -l <service>

2010年5月23日 星期日

iMon VFD on Arch Linux

1. you have to install lirc which provides kernel module ( driver ) support for soundgraph imon devices

pacman -S lirc

2. use the command, modinfo, to find out all parameters of a module

modinfo lirc_imon
--

filename: /lib/modules/2.6.33-ARCH/kernel/drivers/misc/lirc_imon.ko
..
..
parm: debug:Debug messages: 0=no, 1=yes(default: no) (int)
parm: display_type:Type of attached display. 0=autodetect, 1=vfd, 2=lcd, 3=vga, 4=none (default: autodetect) (int)
..
..

3. create a module setting for imon vfd

vi /etc/modprobe.d/lirc_imon.conf
--

options lirc_imon display_type=1

4. enable lirc_imon module

modprobe lirc_imon

after that, my linux created two device files, /dev/lirc0 /dev/lcd2

5. copy correct remote setting to /etc/lircd.conf, my model is imon pad

cp /usr/share/lirc/remotes/imon/lircd.conf.imon-pad /etc/lircd.conf


6. start lirc daemon

/etc/rc.d/lircd start


7. install LCDproc in AUR

yaourt lcdproc

8. edit server configuration file, /etc/LCDd.conf

vi /etc/LCDd.conf
--

..
..
Driver=imon
..
..
[imon]

# select the device to use
Device=/dev/lcd2

# display dimensions
Size=16x2
..
..

9. start lcdproc server daemon

/etc/rc.d/lcdd start

10. edit client configuration file, /etc/lcdproc.conf

vi /etc/LCDd.conf
--
# address of the LCDd server to connect to
Server=localhost

# Port of the server to connect to
Port=13666

# set reporting level
ReportLevel=7

# report to to syslog ?
ReportToSyslog=false

# run in foreground [default: false; legal: true, false]
#Foreground=true

# PidFile location when running as daemon [default: /var/run/lcdproc.pid]
#PidFile=/var/run/lcdproc.pid

# slow down initial announcement of modes (in 1/100s)
#delay=2

# display name for the main menu [default: LCDproc HOST]
#DisplayName=lcdproc


## screen specific configuration options ##

[CPU]
# Show screen
Active=True
OnTime=1
OffTime=2
ShowInvisible=false


[Iface]
# Show screen
Active=True

# Show stats for Interface0
Interface0=eth0
# Interface alias name to display [default: ]
Alias0=LAN

# Show stats for Interface1
#Interface1=eth1
#Alias1=WAN

# Show stats for Interface2
#Interface2=eth2
#Alias2=MGMT

# for more than 3 interfaces change MAX_INTERFACES in iface.h and rebuild

# Units to display [default: byte; legal: byte, bit, packet]
unit=bit

# add screen with transferred traffic
#transfer=TRUE


[Memory]
# Show screen
Active=True


[Load]
# Show screen
Active=True
# Min Load Avg at which the backlight will be turned off [default: 0.05]
LowLoad=0.05
# Max Load Avg at which the backlight will start blinking [default: 1.3]
HighLoad=1.3


[TimeDate]
# Show screen
Active=True
# time format [default: %H:%M:%S; legal: see strftime(3)]
TimeFormat="%H:%M:%S"
# date format [default: %x; legal: see strftime(3)]
DateFormat="%x"


[About]
# Show screen
Active=false


[SMP-CPU]
# Show screen
Active=false


[OldTime]
# Show screen
Active=false
# time format [default: %H:%M:%S; legal: see strftime(3)]
TimeFormat="%H:%M:%S"
# date format [default: %x; legal: see strftime(3)]
DateFormat="%x"


[BigClock]
# Show screen
Active=false


[Uptime]
# Show screen
Active=false


[Battery]
# Show screen
Active=false


[CPUGraph]
# Show screen
Active=false


[ProcSize]
# Show screen
Active=false


[Disk]
# Show screen
Active=false


[MiniClock]
# Show screen
Active=false
# time format [default: %H:%M; legal: see strftime(3)]
TimeFormat="%H:%M"


# EOF

11. run lcdproc as root because of the permission of default PidFile location

sudo lcdproc

12. various clients were made for different displays dimensions so the only way is modify the source code if you want to make a client fit for your lcd

2010年5月4日 星期二

Mouse and Keyboard Sharing between Linux and Windows

synergy lets you share a single mouse and keyboard between multiple computers with different operating systems via network so one of them must be server, others would be clients
synergy+ is a maintenance fork for implementing bug fixes to the original synergy which hasn't any source updates since 2006

1. install synergy-plus on my server side, arch linux

yaourt synergy-plus

2. edit the configuration file on the server side

vi /etc/synergy.conf
--

# declare name of screens
section: screens
server:
client:
end

# specify relative positions
section: links
server:
right = client
client:
left = server
end

section: aliases
end

section: options
relativeMouseMoves = true
end

# windows is my client which be located right to linux.
# in other words, linux is left to windows.
# if set relativeMouseMoves to true then secondary screens move the mouse using relative moves only when the cursor is locked to the screen (by Scroll Lock or a configured hot key). this option makes synergy work better with certain games.

3. autorun synergy server when log in

vi ~/.config/autostart/synergys.desktop
--

[Desktop Entry]
Type=Application
Exec=/usr/bin/synergys


4. download and install synergy+ on the client side, windows

http://synergy-plus.googlecode.com/files/synergy-plus-1.3.4-Windows-x86-r1.exe

5. if the client synergy is on windows vista or 7, you may face UAC conflicts with it. first is unable to use synergy to login windows. second is synergy stop working when a uac prompt appears.
the solution is run synergy+ as administrator and configure it autostart when computer starts and install The Vista Syn to load synergy as a service

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