Sunday, October 26, 2014

file synchronization / replication

lsyncd, rsync, unison, drbd, csync2

Thursday, October 23, 2014

debian missing firmware issue when installation

You have to put all directories

e.g. RTL8192E, RTL8192SU, rtl_nic and rtlwifi

into a vfat formatted usb drive. Then upon installation of debian,
it will ask you to insert it. You have to take off the usb drive
with debian installation software. Insert the usb drive with this firmware.
Next. Next. Then take off the usb drive with this firmware. Insert the
usb drive with debian installation software.

*** important ***

Then, you will encounter this error:

There was a problem reading data from the CD-ROM. Please make sure
it is in the drive. If retrying does not work., you should check
the integrity of your CD-ROM.

Failed to copy file from CD-ROM. Retry?

You have to ctrl+alt+f2 (switch to another console).

Then, mount /dev/sdc1 /cdrom, assuming the installation usb drive is
/dev/sdc1.

Switch back to the previous console. Go.

Friday, October 10, 2014

transmission-daemon

transmission-daemon -g /home/debian/.config/transmission-daemon transmission-remote -l
transmission-remote -t all -S # stop

Wednesday, August 27, 2014

pre-revprop-change for svnsync

#!/bin/sh

USER="$3"

if [ "$USER" = "root" ]; then exit 0; fi

echo "Only the syncuser user may change revision properties" >&2
exit 1

Monday, August 25, 2014

Using Tilde (~) character to switch keyboard layout works very slowly in Windows 7

This is how to fix it.

http://www.overconda.com/?p=36

Thursday, July 31, 2014

how to factory reset lenovo a369i

All other how-to s I find from Google don't work.

The instructions below is proven to work by myself.
  • Turn off your phone.
  • Take battery off.
  • Insert battery.
  • Press power key, volume down key and volume up key and hold them together at the same time.
  • Your phone boots into "meta something" mode.
  • Press power key 1 time.
  • Press volume down multiple times until you reach "wipe data/factory reset".
  • Press volume up key 1 time.
  • Press volume down multiple times until you reach "yes".
  • Press volume up key 1 time.
  • Wait until "data wipe complete".
  • Press volume down or up or power button (sorry I forgot).
  • Choose reboot system now.
  • Press volume up key 1 time.


Tuesday, June 17, 2014

Thursday, June 12, 2014

using memcache for php session

สรุป พอคนเข้าเว็บเยอะ php บน debian หรือ ubuntu ไปเรียกใช้ "fuser" ในการจัดการไฟล์ session ที่หมดอายุ ซึ่งมีประสิทธิภาพต่ำมาก ต้องเปลี่ยนไปใช้ memcache แทน ฉะนั้น ปัญหาจึงหาย และ จำไว้เป็นบทเรียน


Thursday, June 5, 2014

a working iptables firewall rules

#!/bin/bash

# eth0 is connected to the Internet
# eth3 is network B

# flush all chains
iptables -F
# flush all chaines in nat table
iptables --table nat -F

# default policies
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
iptables -P INPUT DROP

# allow unlimited traffic on loopback
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

# {{{ packet forwarding
# allow packet forwarding for the entire LAN
iptables -A FORWARD -i eth3 -o eth3 -j ACCEPT # network B

# masquerade
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE

# allow packet forwarding from internal network to the internet
# and allow packet forwarding from the internet to internal network
# if the packet is established or related from the internal network
iptables -A FORWARD -i eth3 -j ACCEPT # network B
iptables -A FORWARD -i eth0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
# }}} packet forwarding

# ssh
iptables -A INPUT -i eth0 -p tcp -s external_ip_0,external_ip_1 --dport 22 \
  -j ACCEPT

# mosh
iptables -A INPUT -i eth0 -p udp -s external_ip_0,external_ip_2 \
  --dport 60000:61000 -j ACCEPT
# }}}

# allow incoming packets from related or established existing trusted
# connections so that we can connect to the Internet from this gateway
iptables -A INPUT -i eth0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT