Skip to content

Instantly share code, notes, and snippets.

@rickytato
rickytato / gDNS.py
Created November 3, 2011 22:37 — forked from gleicon/gDNS.py
gevent/dnslib/redis based DNS server
# dns server using dnslib and gevent
# based on https://bitbucket.org/paulc/dnslib/src/80d85555aae4/src/server/gevent_server.py
# set the key as
# set IP:name ip_addr
# set TXT:name txtfield
# fallback on gevent's dns resolver
# gleicon 2011
import gevent
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
@rickytato
rickytato / gist:1569999
Created January 6, 2012 10:24
pylibpcap-0.6.3 failed
python setup.py build
running build
running build_ext
building '_pcapmodule' extension
swig -Wall -python -shadow -ISWIG -o pcap.c pcap.i
/root/sandbox/env/pcap/bin/python ./build-tools/docify.py pcap.c
/root/sandbox/env/pcap/bin/python ./build-tools/docify-shadow.py pcap.py
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_COBJECT_TYPES -I/usr/include/python2.7 -c pcap.c -o build/temp.linux-x86_64-2.7/pcap.o
pcap.c:4143:41: error: ‘_wrap_SWIG_PyInstanceMethod_New’ undeclared here (not in a function)
pcap.c:4143:88: error: ‘_doc_SWIG_PyInstanceMethod_New’ undeclared here (not in a function)
@rickytato
rickytato / vbox_to_kvm.txt
Created June 15, 2012 07:33 — forked from bdha/vbox_to_kvm.txt
Migrating from VirtualBox to KVM on ZFS
# It's important to convert the vbox image (VMDK or VDI or whatever) using
# the same version of VirtualBox that created it. You can try converting the image
# with qemu-img or kvm-img, but weird version mismatches will possibly make it not
# work.
# On your VirtualBox machine:
cd $VBOX_ROOT/$MACHINE_ROOT/
VBoxManage clonehd machine.vmdk machine.img --format RAW
scp machine.img root@kvm-host:/somewhere
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
pool: zfspool
state: ONLINE
scan: scrub repaired 0 in 1h40m with 0 errors on Sun Oct 13 23:26:38 2013
config:
NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
d0 ONLINE 0 0 0
d1 ONLINE 0 0 0
+ make -j12
make[2]: Entering directory `/tmp/zfs-build-root-C2IOIjMG/BUILD/zfs-kmod-0.6.2/_kmod_build_3.10-0.bpo.3-amd64'
make all-recursive
make[3]: Entering directory `/tmp/zfs-build-root-C2IOIjMG/BUILD/zfs-kmod-0.6.2/_kmod_build_3.10-0.bpo.3-amd64'
Making all in include
make[4]: Entering directory `/tmp/zfs-build-root-C2IOIjMG/BUILD/zfs-kmod-0.6.2/_kmod_build_3.10-0.bpo.3-amd64/include'
Making all in linux
make[5]: Entering directory `/tmp/zfs-build-root-C2IOIjMG/BUILD/zfs-kmod-0.6.2/_kmod_build_3.10-0.bpo.3-amd64/include/linux'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/zfs-build-root-C2IOIjMG/BUILD/zfs-kmod-0.6.2/_kmod_build_3.10-0.bpo.3-amd64/include/linux'
@rickytato
rickytato / zfs.conf
Created November 21, 2013 11:30
zfsonlinux modules
#options zfs zfs_arc_min=8589934592 zfs_arc_max=17179869184
# Min 4096MB / Max 8192MB Limit
#options zfs zfs_arc_min=4294967296
#options zfs zfs_arc_max=8589934592
blacklist spl
blacklist zfs
blacklist zunicode
blacklist zavl
blacklist zcommon
blacklist znvpair
@rickytato
rickytato / ddb.txt
Created December 4, 2013 18:09
Freenas fatal error on carp creation on Virtualbox
db:0:kdb.enter.default> show allpcpu
Current CPU: 0
cpuid = 0
dynamic pcpu = 0x409180
curthread = 0xfffffe000295d490: pid 12 "swi4: clock"
curpcb = 0xffffff800024cd00
fpcurthread = none
idlethread = 0xfffffe000294c490: tid 100003 "idle: cpu0"
curpmap = 0xffffffff81176110
@rickytato
rickytato / normalize_cpu_affinity.cron
Last active September 17, 2015 18:48 — forked from combatpoodle/normalize_php_fpm_affinity.cron
Normalize PHP-FPM CPU affinityAssumes 8 processors, #0 assigned to kernel+nginx
* * * * * root /usr/local/bin/normalize_cpu_affinity.sh