Skip to content

Instantly share code, notes, and snippets.

View jrziviani's full-sized avatar

Jose R. Ziviani jrziviani

View GitHub Profile
gcc -I/home/ziviani/virt/qemu/qemu-devel/tcg -I/home/ziviani/virt/qemu/qemu-devel/tcg/i386 -I/home/ziviani/virt/qemu/qemu-devel/linux-headers -I/home/ziviani/virt/qemu/qemu-devel/build/linux-headers -I. -I/home/ziviani/virt/qemu/qemu-devel -I/home/ziviani/virt/qemu/qemu-devel/include -I/home/ziviani/virt/qemu/qemu-devel/target-ppc -Itarget-ppc -I/usr/include/pixman-1 -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -I/usr/include/libpng12 -I../linux-headers -I.. -I/home/ziviani/virt/qemu/qemu-devel/target-ppc -DNEED_CPU_
@jrziviani
jrziviani / mutt.txt
Last active September 5, 2022 16:30
mutt cheat sheet
Mutt
http://www.mutt.org/doc/manual/manual.html
Select (tag) messages: shift+t (T)
= (string)
~ (expression)
~b expr (message with expr in body)
[b]body
@jrziviani
jrziviani / latency.txt
Created May 2, 2016 20:16 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@jrziviani
jrziviani / listen.py
Created January 27, 2016 19:03
listen socket python
def listen1(self):
self._console.eventAddCallback(libvirt.VIR_STREAM_EVENT_READABLE,
self._send_to_client,
None)
def libvirt_event_loop():
while True:
libvirt.virEventRunDefaultImpl()
@jrziviani
jrziviani / lvm.sh
Created January 27, 2016 16:16
Create PVs and VG
[root@localhost ~]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb
[root@localhost ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.27).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
@jrziviani
jrziviani / p.patch
Created December 21, 2015 13:19
multifunction support
---
src/conf/domain_addr.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
// http://svn.python.org/view/python/trunk/Include/object.h
#define PyObject_HEAD \
_PyObject_HEAD_EXTRA \
Py_ssize_t ob_refcnt; \
struct _typeobject *ob_type;
#define PyObject_VAR_HEAD \
PyObject_HEAD \
Py_ssize_t ob_size; /* Number of items in variable part */
>>> sda = b.devicetree.getDeviceByName("sda")
>>> new_part = b.newPartition(size=Size("10GiB"), parents=[sda])
>>> b.createDevice(new_part)
>>> blivet.partitioning.doPartitioning(b)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/blivet/partitioning.py", line 889, in doPartitioning
allocatePartitions(storage, disks, partitions, free)
File "/usr/lib/python2.7/site-packages/blivet/partitioning.py", line 1006, in allocatePartitions
disklabel = disklabels[_disk.path]
@jrziviani
jrziviani / blivet_kickstart
Last active August 29, 2015 14:07
Blivet sample using kickstart
from pykickstart.parser import *
from pykickstart.version import makeVersion
import blivet
# parse kickstart
ksparser = KickstartParser(makeVersion())
ksparser.readKickstart("test.ks")
# create blivet object
b = blivet.Blivet(ksparser.handler)
unsigned int nonFloatingWindows = 0;
using lbPair = std::pair<const long unsigned int,
std::unique_ptr<IWindow>>;
// couting only non-floating windows to calcule the areas
// for tiling them.
std::for_each(
_desktops[_currentDesktop].begin(),
_desktops[_currentDesktop].end(),