Skip to content

Instantly share code, notes, and snippets.

Avatar

Fabian Henze flyser

  • Germany
View GitHub Profile
@flyser
flyser / libvirt-quadro.xml
Created Feb 14, 2015
The libvirt config of my vga passthrough vm
View libvirt-quadro.xml
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name>Windows8-OVMF1</name>
<uuid>d3d9d84e-3ce4-d77e-9bcc-d1fb5ba85813</uuid>
<memory unit='GiB'>8</memory>
<memoryBacking>
<hugepages/>
<locked/>
<nosharepages/>
</memoryBacking>
<memtune>
@flyser
flyser / gist:ed235b51474465c67648
Created May 24, 2014
My shell shortcut to start a dlna server in the current directory
View gist:ed235b51474465c67648
function dlna {
DIR="$(pwd)"
if [[ "$1" != "" ]]; then
DIR="$(realpath "$1")"
fi
echo "Serving '$DIR'"
sed -i "s#.*media_dir.*=.*#media_dir=${DIR}#" ~/.minidlna.conf || return 1
/usr/sbin/minidlnad -d -v -R -f ~/.minidlna.conf -P /dev/null
}
View like pv, but for existing files
#!/usr/bin/env python3
filename = "/var/tmp/test"
interval = 10
targetsize = 2*1000*1000*1000*1000 # 2 TB
import os, time, datetime
file = os.open(filename, os.O_RDONLY)
startsize = os.lseek(file, 0, os.SEEK_END)
View makemkv.sh
#!/bin/sh
if [[ "x$1" = "x" ]]; then
echo "Usage:"
echo " $0 <searchpath>"
exit 1
fi
find "$(readlink -f "$1")" -type d -name STREAM | while read M ; do
cd "$M"
@flyser
flyser / Cournal save hook script
Created Nov 30, 2013
An example save hook script for a Cournal server. Warning: If you use Cournal a lot, the directory will grow quickly. Additional measures are needed to prevent that.
View Cournal save hook script
#!/bin/sh
cd "$1"
shift
# Try to determine a hostname
[[ -z "${HOSTNAME}" ]] && HOSTNAME="$(hostname)"
[[ -z "${HOSTNAME}" ]] && HOSTNAME="localhost"
# Create a predictable git environment
View etc-conf.d-ovsdb-server patch for ovs 2.0.0
--- a/net-misc/openvswitch/files/ovsdb-server_conf 2013-11-14 14:57:07.672176882 +0100
+++ b/net-misc/openvswitch/files/ovsdb-server_conf 2013-11-14 14:46:45.000000000 +0100
@@ -2,12 +2,12 @@
DB_SOCKET="/var/run/openvswitch/db.sock"
# Remote sockets are defined in the database by default
-REMOTE_DB="db:Open_vSwitch,manager_options"
+REMOTE_DB="db:Open_vSwitch,Open_vSwitch,manager_options"
# All certificates and keys are stored in the database (if any)
View gist:6183740
## This is on python 2.7:
In [1]: a = '12345678'
In [2]: %timeit [a[max(i-3,0):i] for i in range(len(a), 0, -3)][::-1]
1000000 loops, best of 3: 1.91 us per loop
In [3]: %timeit format(int(a), ',').split(',')
1000000 loops, best of 3: 1.62 us per loop
@flyser
flyser / What Dart does better than Python.
Created Jun 27, 2013
What Dart does better than Python.
View What Dart does better than Python.
def __init__(self, what, dart, does, better, than, python):
self.what = what
self.dart = dart
self.does = does
self.better = better
self.than = than
self.python = python
View stdin.txt
diff --git a/cournal-server.py b/cournal-server.py
index 75cf46a..44c99cd 100755
--- a/cournal-server.py
+++ b/cournal-server.py
@@ -41,12 +41,14 @@ USERNAME = "test"
PASSWORD = "testpw"
class Page:
+ """
+ A page in a document, having multiple strokes.
View gist:2916476

Cournal is a collaborative note taking and journal application using a stylus.

Why?

I need something to allow collaborative annotation of PDF files, Cournal is therefore heavily inspired by Xournal (note taking) and Gobby (collaboration).

Aim

You can’t perform that action at this time.