Skip to content

Instantly share code, notes, and snippets.

View hoang-tranviet's full-sized avatar

Tran Viet Hoang hoang-tranviet

  • INGI, UCLouvain
  • Belgium
View GitHub Profile
# basic pfctl control
# ==
# Related: http://www.OpenBSD.org
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
@hoang-tranviet
hoang-tranviet / purge.sh
Last active January 6, 2017 16:12 — forked from adrienbrault/purge.sh
Script to reduce VM size before packaging for vagrant
#!/bin/bash
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
@hoang-tranviet
hoang-tranviet / latency.markdown
Created October 9, 2016 08:33 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

wget http://www.netfilter.org/projects/iptables/files/iptables-1.4.21.tar.bz2
tar xf iptables-1.4.21.tar.bz2
cd iptables-1.4.21/
./configure LIBS="-pie -rdynamic" CFLAGS="-fPIC -U_FORTIFY_SOURCE" --with-xtlibdir=/lib/xtables --disable-static
make
readelf -h iptables/.libs/xtables-multi | grep Type:
git clone http://github.com/richardwithnell/iptables
cd iptables/