2011年10月13日 星期四

Set up FreeNX with LXDE on Arch Linux

1. install poptop server
pacman -S pptpd
2. edit the configuration file
vim /etc/pptpd.conf
--

option /etc/ppp/pptpd-options
localip 172.16.1.254
remoteip 172.16.1.1-253
localip is ip of pptp server
remoteip is the ip range which vpn client will get from

3. edit /etc/ppp/pptpd-options
name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
ms-dns 168.95.1.1
ms-dns 168.95.192.1
require-mppe-128 enables encryption
ms-dns is dns server address

4. start pptp server
/etc/rc.d/pptpd start
5. add username and password to /etc/ppp/chap-secrets for ppp authentication
<username>     pptpd     <password>   *
6. make your iphone be a pptp client, General -> Network -> VPN -> Add a VPN -> PPTP
then fill all required fields and save

7. turn on VPN then you'll see the timer start timing

2011年5月17日 星期二

Set up PPTP VPN between Arch Linux and iPhone

1. install poptop server

pacman -S pptpd

2. edit the configuration file

vim /etc/pptpd.conf
--

option /etc/ppp/pptpd-options
localip 172.16.1.254
remoteip 172.16.1.1-253

localip is ip of pptp server
remoteip is the ip range which vpn client will get from

3. edit /etc/ppp/pptpd-options

name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
ms-dns 168.95.1.1
ms-dns 168.95.192.1

require-mppe-128 enables encryption
ms-dns is dns server address

4. start pptp server

/etc/rc.d/pptpd start

5. add username and password to /etc/ppp/chap-secrets for ppp authentication

<username> pptpd <password> *

6. make your iphone be a pptp client, General -> Network -> VPN -> Add a VPN -> PPTP
then fill all required fields and save

7. turn on VPN then you'll see the timer starts to timing

2011年3月27日 星期日

Adding Static ARP on Windows 7

1. run cmd as administrator

2.

netsh

3. switch to interface/ipv4 subtree

interface ipv4

4. store=persistent will make it load this entry automatically at every boot

add neighbors "InterfaceName" "IP" "MAC" store=persistent

2011年3月23日 星期三

Connect Nokia Phone as USB Modem without PC Suite on Windows

1. install nokia cable drivers from http://nds1.nokia.com/files/support/global/phones/software/Nokia_Connectivity_Cable_Driver_eng.msi then connect your phone

2. Device Manager -> Modems -> Nokia Phone -> Properties -> Advanced -> Extra Initialization Commands -> +CGDCONT=,,"APN"
# APN of chunghwa telecom = internet

3. add a new dailup network, type *99# into dail no. and leave the rest blank

4. you can also uncheck "prompt for name and password" in properties because it is unnecessary

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

2009年12月25日 星期五

PCI GW-MF54G2 Serial Output

RXD and TXD must be cross-connected to serial adapter

RXD GND TXD VCC
 ______
|  ....| <- serial
|      |
|      |
|      |
 ----||  <- antenna

2009年12月23日 星期三

Remove Orphan Packages on Arch Linux

1. remove a package's dependencies which are not required by any other installed package

sudo pacman -Rs

2. list all packages no longer required as dependencies

sudo pacman -Qdt

3. combine both commands

sudo pacman -Rns $(pacman -Qqtd)

-n, --nosave # delete .pacsave backup files
-q, --quiet # show less information for certain sync operations

2009年12月22日 星期二

Install Maemo 5 SDK on Arch Linux

1. download GUI Installer made with python from http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/Platforms/Maemo/

2. according to http://wiki.maemo.org/Documentation/Maemo_5_Final_SDK_Installation, the python script needs to be modified for non-debian linux

129c129
< SB_PATH = "/scratchbox"
---
> SB_PATH = "/opt/scratchbox"
2297a2298
> opt = opt + "-s /opt/scratchbox"
2351a2353
> cmd = cmd +" -s /opt/scratchbox"

3. then run the installer

sudo python ./maemo-sdk-install-wizard_5.0.py

4. start the Xephyr xserver

Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac &

-host-cursor # re-use exisiting X host server cursor
-screen WIDTHxHEIGHT # specify screen characteristics
-dpi # screen resolution in dots per inch
-ac # disable access control restrictions
-help # prints message with these options

5. disable vdso support in the host's kernel

vi /etc/sysctl
--

# Disable VDSO support
vm.vdso_enabled = 0

6. load in sysctl settings from the file

sudo sysctl -p

7. log out and log back or login to the new group in the current session

newgrp sbox

8. login to scratchbox

/opt/scratchbox/login

9. set the DISPLAY variable to match the display setting given for the Xephyr server

[sbox-FREMANTLE_X86: ~] > export DISPLAY=:2

10. start the ui framework

[sbox-FREMANTLE_X86: ~] > af-sb-init.sh start

11. method to shutdown

[sbox-FREMANTLE_X86: ~] > af-sb-init.sh stop

12. if your linux is non-debian based, start scratchbox manually when the system is rebooted

sudo /opt/scratchbox/sbin/sbox_ctl start

2009年12月15日 星期二

Check The Bandwidth of Network

iperf is a tool for performing network throughput measurements.

1. install iperf on both nodes

arch linux

sudo pacman -S iperf

windows version can be downloaded from http://www.noc.ucf.edu/Tools/Iperf/

2. one node acts as server, the other node would be client
start listening on server side

iperf -s

3. start connecting to server on client side

iperf -c -w 2m server_ip

# -w 2m adjust windows size to 2 mbytes

4. result should appear in a few secs like this

[1924] 0.0-10.0 sec 111 MBytes 92.9 Mbits/sec

2009年11月8日 星期日

Convert FLAC to MP3 on Arch Linux

1. install necessary packages to decode and encode

sudo pacman -S lame flac

2. pipe the decoded standart output for the encoder

flac -dc input.flac | lame -h - output.mp3

-d decode
-c write output to stdout

-h use some quality improvements

2009年10月22日 星期四

Find out All Online Hosts on the Same LAN on Linux

1. ping allow pinging a broadcast address

ping -b 192.168.0.255

but windows host does not reply broadcast ping

2. use network mapper, nmap

nmap -sP 192.168.0.0/24

-sP: ping scan

3. if a host be set to discard ping request, try to use arping with loop

2009年8月16日 星期日

Convert Video on Linux for Nokia N97

you can save different configurations as profiles for mencoder use.

1. create configuration file ~/.mplayer/mencoder.conf if there is not.
if in windows, the file should be put in the same folder with config and input.conf

2. edit mencoder.conf

[n97]
profile-desc="MPEG4/AAC"
vf=scale=640:-3,harddup
ovc=lavc=yes
oac=lavc=yes
lavcopts=aglobal=1:vglobal=1:acodec=libfaac:vcodec=mpeg4:abitrate=96:vbitrate=896
af=lavcresample=44100
ofps=25
of=lavf=yes
lavfopts=format=mp4

[profile2]
..
..

the quality of video from the above setting is good enough. but you still can adjust them in the suitable range
abitrate: 96 ~ 192
vbitrate: 896 ~ 4000

3. specify which profile to use

mencoder -profile n97 -o output.mp4 input_file

2009年8月12日 星期三

Change the Default Sound Card on Arch Linux

i found the sound module of my tv card was the default sound device because i tried to run amixer and got no master or pcm controls.

1. discover your sound card model name with lspci and your ALSA driver module names with ls

$ ls -l /sys/module/snd/holders
total 0
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 saa7134_alsa -> ../../saa7134_alsa
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_hda_codec -> ../../snd_hda_codec
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_hda_intel -> ../../snd_hda_intel
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_hwdep -> ../../snd_hwdep
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_mixer_oss -> ../../snd_mixer_oss
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_pcm -> ../../snd_pcm
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_pcm_oss -> ../../snd_pcm_oss
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_rawmidi -> ../../snd_rawmidi
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_seq -> ../../snd_seq
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_seq_device -> ../../snd_seq_device
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_seq_oss -> ../../snd_seq_oss
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_timer -> ../../snd_timer
lrwxrwxrwx 1 root root 0 2009-08-13 09:21 snd_usb_audio -> ../../snd_usb_audio

2. add order setting for the module of main soundcard to modprobe.conf

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

options snd_hda_intel index=0

3. make your user be able to use the sound card

gpasswd -a username audio

3. reboot then make sure the sound modules have been loaded

lsmod | grep ^snd_

4. the current version of alsa installs with all channels muted by default. use alsamixer to unmute the channels and adjust volume manually

5. run alsactl once to create /etc/asound.state

alsactl store
# restore
# alsactl restore

6. add alsa to daemons in rc.conf to store the mixer settings on every shutdown and restore them when you boot.

2009年8月5日 星期三

Mount Windows Partition with Correct Character Setting on Linux


mount -t cifs -o iocharset=utf8,username="username",password="password" //ip/share /mountpoint