Skip to content

Instantly share code, notes, and snippets.

{"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
#!/usr/bin/env python2
import qmp
import sys
def onlinecpu():
import numa
o_cpus = []
for node in range(0,numa.get_max_node()+1):

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

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
@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
@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 / 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 / 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'