Skip to content

Instantly share code, notes, and snippets.

Avatar

Rogier 'DocWilco' Mulhuijzen drwilco

View GitHub Profile
View varnishlog2curl.sh
log=$(cat -)
request=$(echo "$log" | grep -E "^ *[0-9]+ TxRequest" | sed -E 's/^ *[0-9]+ TxRequest *b //')
url=$(echo "$log" | grep -E "^ *[0-9]+ TxURL" | sed -E 's/^ *[0-9]+ TxURL *b //')
headers=$(echo "$log" | grep -E "^ *[0-9]+ TxHeader" | sed -E 's/^ *[0-9]+ TxHeader *b (.*)$/-H "\1"/' | paste -s -d ' ' | sed 's/\!/\\\!/g')
read backend lip lport rip rport ssl <<<$(echo "$log" | grep -E "^ *[0-9]+ Backend(Addr|Open)" | sed -E 's/^ *[0-9]+ Backend(Addr|Open) *b //')
if [ "$f" = "SSL" ]; then
proto="https"
else
proto="https"
View gist:5855867
(gdb) i br
Num Type Disp Enb Address What
3 hw watchpoint keep y *(void **)0x604030
breakpoint already hit 7532228 times
silent
if $_siginfo->_sifields->_sigfault->si_addr == 0x7ffff7bd80e1 || *(void **)0x604030 == 0x7ffff2414048
cont
else
bt
end
@drwilco
drwilco / gist:5702807
Last active Dec 18, 2015
assembly and lines intermixed
View gist:5702807
objdump -S /usr/sbin/varnishd | awk '/00000000004836f0/ {flag=1;next}
/0000000000483a30/{flag=0} flag {print}' | while read addr asm
do
line=`addr2line -i -e /usr/sbin/varnishd $addr`
if [ "x$line" != "x$last" ]
then
echo "$addr $line"
fi
echo "$asm"
last="$line"
View 1 timebench.c
/* gcc -o timebench timebench.c -lrt -O2 -fno-inline */
/* no-inline for better readable objdump -d output */
#include <time.h>
#include <sys/time.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@drwilco
drwilco / test.sh
Created Oct 18, 2012
I did something with bash coproc
View test.sh
drwilco@guari:~$ pstree -hp 23944
bash(23944)───grep(2832)─┬─grep(2836)
└─yes(2835)
(23944 is the interactive shell that I used to start test.sh)
View gist:1361753
varnishd -d -f ~/test-directors.vcl -C | grep VGC
#define VGCDIR(n) VCL_conf.director[VGC_backend_##n]
#define VGC_backend__b1 1
#define VGC_backend__b2 2
#define VGC_backend__rr 3
#define VGC_backend__rnd 4
#define VGC_backend__cl 5
#define VGC_backend__hsh 6
#define VGC_backend_dyn_1 1
#define VGC_backend_dyn_2 2
View gist:1283884
My traceroute [v0.73]
brigit.drwilco.net (0.0.0.0) Thu Oct 13 11:57:16 2011
Keys: Help Display mode Restart statistics Order of fields quit
Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. 5ED13001.cm-7-2a.dynamic.ziggo.nl 0.0% 9 7.0 7.2 5.7 10.9 1.6
2. gv-rc0052-ds102-vl202.core.as9143.net 0.0% 9 5.0 7.5 5.0 10.7 1.9
3. gv-rc0011-cr102-ae12-0.core.as9143.net 0.0% 9 7.2 8.4 6.0 11.9 1.6
4. asd-tr0409-cr101-ae8-0.core.as9143.net 0.0% 9 6.6 26.2 6.6 82.0 28.8
5. tengigabitethernet1-3.ar2.ams1.gblx.net 0.0% 8 9.5 8.3 6.5 10.0 1.4
@drwilco
drwilco / 2.1-make-check.log
Created Sep 10, 2011
2.1 branch test failure
View 2.1-make-check.log
Script started on Fri 09 Sep 2011 10:12:18 PM PDT
drwilco@guari:~/dev/varnish$ git clone git://git.varnish-cache.org/varnish-cache 2.1
Cloning into 2.1...
remote: Counting objects: 48004, done.
remote: Compressing objects: 0% (1/14738) 
remote: Compressing objects: 1% (148/14738) 
remote: Compressing objects: 2% (295/14738) 
@drwilco
drwilco / base.conf
Created Sep 8, 2011
setting up base lxc
View base.conf
lxc.network.type = veth
lxc.network.flags = up
lxc.network.name = eth0
lxc.network.link = virbr0
lxc.network.ipv4 = 10.13.37.2/24
You can’t perform that action at this time.