Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️
<typing sounds>

Matthew Tovbin tovbinm

⌨️
<typing sounds>
View GitHub Profile
@tovbinm
tovbinm / .backupignore
Created Feb 26, 2014
Backup Mac using rsync
View .backupignore
.Spotlight-*/
.Trashes
/afs/*
/automount/*
/cores/*
/dev/*
/Network/*
/private/tmp/*
/private/var/run/*
/private/var/spool/postfix/*
@tovbinm
tovbinm / statsd_trap.py
Last active Aug 29, 2015
A handy Statsd trap that outputs all the incoming traffic to console
View statsd_trap.py
import socket, select
s1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s1.bind(('localhost', 8125))
s2 = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_UDP)
s2.bind(('localhost', 8125))
while True:
r, w, x = select.select([s1, s2], [], [])
for i in r:
print i, i.recvfrom(131072)
@tovbinm
tovbinm / instantHTTP
Created Apr 20, 2011 — forked from softprops/instantHTTP
One line Python Web server
View instantHTTP
python -m SimpleHTTPServer
View Change FS scheduler
echo <scheduler> > /sys/block/$disk/queue/scheduler
(http://stackoverflow.com/questions/1009577/selecting-a-linux-i-o-scheduler)
View Add LZO to Hadoop
On Ubuntu:
1.sudo apt-get install lzop liblzo2-dev
2.download and build: https://github.com/kevinweil/hadoop-lzo
3.copy the resulted jar to: <yourhadoop>/lib/, typically: /usr/lib/hadoop/lib/
4.download: http://code.google.com/a/apache-extras.org/p/hadoop-gpl-compression/
5.cp ./hadoop-gpl-compression-0.1.0/lib/native/Linux-<your_acrh_type>/*.* /usr/lib/hadoop/lib/native/Linux-<your_acrh_type>/
6.Add the following properties to core-site.xml:
<property>
<name>io.compression.codecs</name>
<value>org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.DefaultCodec,com.hadoop.compression.lzo.LzoCodec,com.hadoop.compression.lzo.LzopCodec,org.apache.hadoop.io.compress.BZip2Codec</value>
View Replace CTRL+A separator with ','
sed 's/'`echo -e "\01"`'/,/g' input_file.txt > output_file.csv
@tovbinm
tovbinm / Clone entire file system
Created May 1, 2011
File System manipulations
View Clone entire file system
On source:
dd if=/dev/sda | gzip -cf | nc <destination-system-ip> <port>
On destination:
nc -l -p <port> | gzip –dfc | dd of=/dev/sda
(http://conshell.net/wiki/index.php/Linux_P2V)
View Bandwidth shaper
Ubuntu:
sudo apt-get install wondershaper
sudo wondershaper eth0 [down rate in kilobits] [up rate in kilobits]
View diff -u riakclient.proto.piqi riakclient.proto.piqi.edited
$ diff -u riakclient.proto.piqi riakclient.proto.piqi.edited
--- riakclient.proto.piqi 2012-02-08 20:55:35.000000000 -0600
+++ riakclient.proto.piqi.edited 2012-02-08 20:55:25.000000000 -0600
@@ -299,6 +299,7 @@
]
.field [
.name done
+ .ocaml-name "ocaml_done"
.type bool
.optional
@tovbinm
tovbinm / bashrc
Created Feb 23, 2012
Git/SVN branch in bash
View bashrc
parse_git_branch () {
git symbolic-ref HEAD 2> /dev/null | sed 's#refs/heads/\(.*\)# \1#'
}
parse_svn_branch() {
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' |
awk '{print " (svn::"$1")" }'
}
parse_svn_url() {
svn info 2>/dev/null | sed -ne 's#^URL: ##p'
}
You can’t perform that action at this time.