Pages

November 22, 2009

Turn on word wrapping in "pre" tag

On Blogger, you need to edit template to turn on wrapping of tag "pre", otherwise long lines are not showing correctly. So paste this to your template:
pre {
white-space: -moz-pre-wrap; /* Mozilla, supported since 1999 */
white-space: -pre-wrap; /* Opera 4 - 6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
 background: #dddddd;
 display: block;
 padding: 0.5em 1em;
 border: 1px solid #bebab0;
}

November 4, 2009

Redhat 5 + serial console setup

Here is quick setup of serial console for RedHat 5. It works for other linux distros too.
# grep agetty /etc/inittab
S0:12345:respawn:/sbin/agetty ttyS0 9600 vt100-nav

# grep SAFE /etc/sysconfig/kudzu
SAFE=yes

# grep ttyS0 /etc/securetty
ttyS0

# cat /boot/grub/menu.lst
default=0
timeout=5
hiddenmenu
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console
title Red Hat Enterprise Linux Server (2.6.18-164.2.1.el5)
 root (hd0,0)
 kernel /vmlinuz-2.6.18-164.2.1.el5 ro root=/dev/VolGroup00/rootvol console=tty0 console=ttyS0,9600n8 quiet
 initrd /initrd-2.6.18-164.2.1.el5.img

August 22, 2008

Installing geoip netfilter module under fedora 9

Just few tips, after you have patched current kernel sources and iptables, you want now compile geoip module (not whole kernel).

So in kernel sources dir, where is also Makefile, execute this commands:
make modules_prepare
make -C $(pwd) M=net/netfilter/ modules
cp net/netfilter/xt_geoip.ko /lib/modules/`uname -r`/extra/
depmod -a
modprobe xt_geoip

April 29, 2008

Using .htaccess files easy way

If you have configured .htaccess file in your public_html like this...
cat ~/public_html/private/.htaccess
AuthType Basic
AuthUserFile /path/to/homedir/public_html/private/.htpasswd
AuthGroupFile /dev/null
AuthName AnyNameYouLike
require valid-user

... you will have problem to allow guest to read subdir without entering password. Thats why this .htaccess file will help you:
cat ~/public_html/private/guestok/.htaccess
AuthName AnyNameYouLike
Allow from all
Satisfy any

April 6, 2008

Setup Debian Etch on NSLU2 for torrent downloading

Hi, if you don't already have cheap, small, power efficient and silent file server at home, meet NSLU2. This is way of setting up Debian after its installing for more or less torrent downloading.

March 6, 2008

Shape application easy way

Want to limit bandwidth for some specific program in userspace? Use trickle!

Example for shaping scp download to 100KB/s:
trickle -d 100 scp remote.host.ip:big_file.iso .

February 15, 2008

Make kernel module 2.6

To make kernel module under kernel 2.6, just rename module and execute make.
# cat Makefile 
obj-m := ptpatch2008.o

KDIR := /lib/modules/`uname -r`/build
PWD := `pwd`

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

February 7, 2008

January 20, 2008

Simple config for rTorrent

This is basic config file for rTorrent (0.7.8/0.11.8) I use. Just first make sure referenced dirs exist. Note: rates are in KB/s.

December 10, 2007

Fast remote dir copy using netcat

Hey, this tip I used so many times! For situations, where network is not a bottleneck, I like using netcat for remote dir copy. For example, I want to fast copy dir /opt/sybase (which has 50GB) from one machine to another. I will tell netcat to listen on port 2000 on destination host and wait for data. Then from source host I will connect to destination host and pump data in.

On destination host type:
cd /opt
nc -l -p 2000 | tar -xf -
edit: Newer netcat, command will looks like "nc -l 2000 | tar -xf -"
Next on source host type:
cd /opt
tar -cf - sybase | nc destination.host.ip 2000

Enjoy!

November 1, 2007

Simple linux firewall for dedicated company network

Hi, we will setup basic firewall for small dedicated company network. Situation: all services for LAN users (email, proxy, dns, ntp) are situated in main company network, to which we connect using OpenVPN. So router acts as OpenVPN client, enabling tunneled incoming connections to this LAN from main company network. Created for Slackware. Take all this as fun example.

October 12, 2007

Minimal smb.conf for Mac OS X Tiger and Leopard

Hi, I am posting files /etc/smb.conf which work under Mac OS X 10.4.10+ (Tiger) and 10.5 (Leopard) for sharing directory /data to other Linux/Windows machines on LAN without password.

For Mac OS X 10.4.10+ Tiger (Samba 3.0.10) trick was to specify guest account and security. For sharing read/write, uncomment last line.
[global]
guest account = unknown
security = share
server string = skynet
netbios name = skynet
guest ok = yes
oplocks = yes
[data]
path = /data
# read only = no

For Mac OS X 10.5 Leopard (Samba 3.0.25b-apple) remove security line:
[global]
guest account = unknown
server string = skynet
netbios name = skynet
guest ok = yes
oplocks = yes
[data]
path = /data
# read only = no

October 11, 2007

Binding process to specific CPU

Hi, there is easy way to bind process for specific CPU under Linux and Solaris.

Under Linux to bind process to CPU 0:
 taskset -c 0 process

To bind existing process with PID 22560 to processor 1:
taskset -pc 1 22560

For NUMA systems look at numactl utility.

Under Solaris to bind process with PID 208 to CPU 2:
pbind -b 2 208

June 20, 2007

Observing Solaris 10 tcp/ip stack

Hi, let's take a look for ususal network related command under Solaris 10. To understand how to things work deeply, see this page.

June 5, 2007

Sony Ericsson K600i as bluetooth dialup modem

Hi! In this article I will show you how I connected to the internet using laptop Compaq Evo N1000v & cell phone Sony Ericsson K600i. My mobile operator is Orange Slovensko. I did it under Slackware Linux 11. We will setup bluetooth connection between these devices.