Skip to content

Instantly share code, notes, and snippets.

View qemu-qmp.md

QEMU Machine Protocol (QMP) socket

Start QEMU with QMP UNIX socket and connect:

qemu-system-x86_64 -qmp unix:test.socket,server,nowait ...
nc -U test.socket
qmp-shell test.socket    # use the raw qmp interface. see https://github.com/0xef53/qmp-shell
qmp-shell -H test.socket # use the human interface.   see https://github.com/0xef53/qmp-shell
View nginx.conf
user lbakken lbakken;
worker_processes 1;
# Note: for debugging, very useful
# error_log /dev/stderr debug;
error_log /dev/stderr;
pid nginx.pid;
worker_rlimit_nofile 1024;
daemon off;
events {
@imperialguy
imperialguy / comm.py
Created Jul 13, 2018 — forked from drocco007/comm.py
Python generator rate limiter using token bucket
View comm.py
from time import time, sleep
_128k = 128 * 1024
_256k = 256 * 1024
_512k = 512 * 1024
_1024k = 1024 * 1024
class TokenBucket(object):
@imperialguy
imperialguy / XMLtoJSON.py
Created Mar 8, 2018 — forked from smihica/XMLtoJSON.py
Xml to JSON parser-converter in Python.
View XMLtoJSON.py
#!/usr/bin/env python -S
# -*- coding: utf-8 -*-
import sys
import re
import xml.sax
import io # for 2.6
import StringIO # for 3.0
#
# ** If your python is 2.x and xml-cording is utf-8 set follows.
@imperialguy
imperialguy / xml2json.py
Created Mar 8, 2018 — forked from Ceasar/xml2json.py
Convert xml to json.
View xml2json.py
'''A module for converting xml into json.'''
import json
from lxml import etree
def xml_to_json(xml_input, json_output):
'''Converts an xml file to json.'''
dict_to_json(etree_to_dict(xml_to_etree(xml_input), True), json_output)