Skip to content

Instantly share code, notes, and snippets.

View gz's full-sized avatar

Gerd Zellweger gz

View GitHub Profile
@gz
gz / auto_sass.py
Created May 5, 2010 14:04
automatic sass to css compiling
#!/usr/bin/env python
# auto_sass.py - watches your sass files in a directory and compiles them to a css file
# whenever you save it.
# currently this only works under linux and requires pynotify
# use: ./auto_sass.py <directory>
import os, sys, subprocess
from pyinotify import WatchManager, Notifier, ProcessEvent, IN_CLOSE_WRITE
SASS_FILE_EXTENSION = 'sass'
CSS_FILE_EXTENSION = 'css'
@gz
gz / gdb.md
Last active May 17, 2020 00:06
GDB debug and performance cheat-sheet

GDB

Attach to PID

rust-gdb binary pid

Take a core-dump of a running process

gcore pid

Change frame in backtrace

  • bt: prints all frames
@gz
gz / qemu.md
Last active May 17, 2020 00:05
Qemu tipps and trick

QEMU usage tipps

Memory check

Check QEMU memory consumption:

numastat -czs kvm qemu
@gz
gz / server_packages.bash
Last active April 25, 2023 08:18
Script to initialize a new development server.
# Ubuntu useful packages
adduser gz
usermod -aG sudo gz
usermod -aG kvm gz
echo "gz ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
su gz
sudo apt-get -y install binutils
sudo apt-get -y install build-essential
sudo apt-get -y install cabal-install

NTP blocked:

sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"

Set timezone:

sudo dpkg-reconfigure tzdata

Uncomment all #deb-src lines in /etc/apt/sources.list

Run the following commands:

sudo apt update
sudo apt install build-essential
sudo apt build-dep qemu
wget https://download.qemu.org/qemu-5.0.0.tar.xz
tar xvJf qemu-5.0.0.tar.xz
cd qemu-5.0.0
#!/usr/bin/env python2
import qmp
import sys
def onlinecpu():
import numa
o_cpus = []
for node in range(0,numa.get_max_node()+1):
{"index":{"0":0,"1":1,"2":0,"3":1,"4":0,"5":1,"6":0,"7":1,"8":0,"9":1,"10":0,"11":1,"12":0,"13":1,"14":1,"15":0,"16":0,"17":1,"18":0,"19":1,"20":0,"21":1,"22":1,"23":0,"24":0,"25":1,"26":0,"27":1,"28":0,"29":1,"30":0,"31":1,"32":1,"33":0,"34":0,"35":1,"36":0,"37":1,"38":0,"39":1,"40":1,"41":0,"42":0,"43":1,"44":0,"45":1,"46":0,"47":1,"48":0,"49":1,"50":1,"51":0,"52":0,"53":1,"54":0,"55":1,"56":0,"57":1,"58":0,"59":1,"60":0,"61":1,"62":0,"63":1,"64":0,"65":1,"66":0,"67":1},"git_rev":{"0":"9b7d0f9b1e9164d84a626fe71bc04f7904e5b5ca","1":"9b7d0f9b1e9164d84a626fe71bc04f7904e5b5ca","2":"67453cd54b8fd74c93eb76a6f6c9722ef3f94654","3":"67453cd54b8fd74c93eb76a6f6c9722ef3f94654","4":"4a4f19795e7148c5e6401bbb2c021d6e59622cfb","5":"4a4f19795e7148c5e6401bbb2c021d6e59622cfb","6":"71977e090df83fdcc1d14c7a685147b4310ff810","7":"71977e090df83fdcc1d14c7a685147b4310ff810","8":"89f2af68f99947822ccc0ae4012662fe72d10b57","9":"89f2af68f99947822ccc0ae4012662fe72d10b57","10":"8f8890e82f6fd16e794a9725c679e2054ed74ff5","11":"8f8890e82f6f
set -ex
sudo apt-get build-dep libmemcached-tools
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18/
LDFLAGS='-lpthread' CXXFLAGS='-fpermissive' CFLAGS='-Wno-errors -fpermissive' ./configure --enable-memaslap --with-pthread=yes
make -j12
sudo make install
sudo ldconfig
@gz
gz / t1_vs_t2.log
Last active June 25, 2020 00:03
nr autoperf run 100% write HT
Events that predominantly trigger in thread2 and not in thread1
Event name: Fraction (progB - progA = difference)
=================================================
MAX.UNC_M2M_RxR_OCCUPANCY.AK_BNC: 0.95 (182665.0-9496.0=173169.0)
MAX.UNC_M2M_AG1_BL_CRD_OCCUPANCY.TGR2: 0.95 (4870730.0-251402.0=4619328.0)
MAX.UNC_M2M_RxR_INSERTS.AK_BNC: 0.95 (231112.0-11920.0=219192.0)
MAX.UNC_M2M_HORZ_RING_IV_IN_USE.RIGHT: 0.95 (63167.0-3218.0=59949.0)
MAX.UNC_CHA_XSNP_RESP.EVICT_RSP_HITFSE: 0.95 (2262.0-115.0=2147.0)
MAX.UNC_M2M_RING_BOUNCES_VERT.AD: 0.95 (455.0-23.0=432.0)