Thursday, December 03, 2009

Null values in Hadoop 0.20.1 Writable

If any of the elements of a custom Writable are NULL, Hadoop will fail silently on my machine. So, make sure you don't try to write NULL variables.

Tuesday, July 07, 2009

Ubuntu Dell XPS M1330 low volume mic/microphone fix

http://ubuntuforums.org/showpost.php?p=6718591&postcount=27

(restart session )

Sunday, July 05, 2009

Untar all files in a folder
for a in `ls -1 *.tar.gz`; do tar -zxvf $a; done
or
for a in `ls -1 *.tgz`; do tar -zxvf $a; done

Friday, June 05, 2009

VMware keyboard bug under Ubuntu/Linux

To reset your keyboard map - setxkbmap

http://experts.missouristate.edu/display/csvhelpdesk/Reset+Keyboard+Map

Sunday, May 31, 2009

Unzip all zip files in the current folder

for f in *.zip;do unzip "$f";done

Wednesday, May 20, 2009

Distributed key-value stores

http://www.metabrew.com/article/anti-rdbms-a-list-of-distributed-key-value-stores/ - Anti-RDBMS: A list of distributed key-value stores

http://randomfoo.net/2009/04/20/some-notes-on-distributed-key-stores - Some Notes on Distributed Key Stores

http://bret.appspot.com/entry/how-friendfeed-uses-mysql - How FriendFeed uses MySQL to store schema-less data

http://anyall.org/blog/2009/04/performance-comparison-keyvalue-stores-for-language-model-counts/ - Performance comparison: key/value stores for language model counts

http://michalfrackowiak.com/blog:redis-performance - Redis Performance on EC2 (aka weekend project coming)

http://labs.gree.jp/Top/OpenSource/Flare-en.html - Flare is distributed, and persistent key-value storage - pluggable storage (currently only Tokyo Cabinet is available, though:)

http://blip.tv/file/1949416/ - Drop ACID and think about data

http://www.igvita.com/2009/02/13/tokyo-cabinet-beyond-key-value-store/ - Tokyo Cabinet: Beyond Key-Value Store

http://www.scribd.com/doc/12016121/Tokyo-Cabinet-and-Tokyo-Tyrant-Presentation - Tokyo Cabinet and Tokyo Tyrant Presentation
Installing Tokyo Tyrant on Ubuntu 9.04 (Jaunty), in custom folders/directories

Tokyo Cabinet - first install this
-------------
cd /usr/local/src/
wget http://tokyocabinet.sourceforge.net/tokyocabinet-1.4.21.tar.gz
tar xvf tokyocabinet-1.4.21.tar.gz
cd tokyocabinet-1.4.21
apt-get install zlib1g-dev
apt-get install libbz2-dev
mkdir /usr/local/tokyocabinet-1.4.21/
./configure --prefix=/usr/local/tokyocabinet-1.4.21/
make
make install

Tokyo Tyrant
------------
cd /usr/local/src/
wget http://tokyocabinet.sourceforge.net/tyrantpkg/tokyotyrant-1.1.27.tar.gz
tar xvf tokyotyrant-1.1.27.tar.gz
cd tokyotyrant-1.1.27
mkdir /usr/local/tokyotyrant-1.1.27
./configure --prefix=/usr/local/tokyotyrant-1.1.27/ --with-tc=/usr/local/tokyocabinet-1.4.21/
make
make install

Fix lib problem
------------
cd /usr/local/tokyotyrant-1.1.27/bin/
./ttserver

You will get this error: ./ttserver: error while loading shared libraries: libtokyocabinet.so.8: cannot open shared object file: No such file or directory

To fix it,
cd /usr/local/tokyotyrant-1.1.27/
ln -s /usr/local/tokyocabinet-1.4.21/lib/libtokyocabinet.so.8 lib/
./bin/ttserver will now work

Thursday, May 14, 2009

Easily changing the timezone in Ubuntu server

dpkg-reconfigure tzdata

Tuesday, March 24, 2009

How to delete a certain line from a file in Linux

sed -i 321d /path/to/file

where 321 is the line number

Thursday, March 12, 2009

Ramdisk in Linux/Ubuntu

sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs tmpfs /mnt/ramdisk -o size=100M,nr_inodes=200k,mode=01777

Monday, February 02, 2009

Pipe Viewer

"Pipe viewer is a terminal-based tool for monitoring the progress of data through a pipeline. It can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion."

http://www.catonmat.net/blog/unix-utilities-pipe-viewer/

Tuesday, January 06, 2009

Protecting from a DDOS SYN FLOOD on port 80 (Apache, Ubuntu)

Other keywords: SYN_RECV, TIME_WAIT

sysctl -w net.ipv4.tcp_synack_retries="1"
sysctl -w net.ipv4.tcp_max_syn_backlog="40000"
sysctl -w net.ipv4.netfilter.ip_conntrack_max="200000"
sysctl -w net.ipv4.tcp_fin_timeout="3"

/sbin/iptables -A INPUT -i eth2 -p tcp --tcp-flags ALL ACK,RST,SYN,FIN -j DROP
/sbin/iptables -A INPUT -i eth2 -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
/sbin/iptables -A INPUT -i eth2 -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
(you can ignore the iptables part, probably doesn't help that much)

In Apache, increase the maximum number of concurrent connections.

I also learned that while in theory putting a squid in reverse proxy on port 80 to protect the Apache behind it is a good idea, squid sucks at it.

Oh, I almost forgot. Make sure syn_cookies is active (if you kernel supports it):
echo 1 > /proc/sys/net/ipv4/tcp_syncookies

Google is your friend for further details on the above settings.

More:
http://tools.ietf.org/html/rfc4987#section-3.5
http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_9-4/syn_flooding_attacks.html