Skip to content

Instantly share code, notes, and snippets.

@yiannist
yiannist / fixed-iops.patch
Created September 1, 2017 13:08
Fixed BPS/IOPS in Ganeti
commit 8f01086581bc1abc29b9e8c4d2cc41915f858f7a
Author: Ansgar Jazdzewski <ajaz@spreadshirt.net>
Date: Tue May 9 12:57:42 2017 +0200
Disk I/O limits allow us to control the amount of I/O that a guest can perform. This is useful for example if we have several VMs in the same host and we want to reduce the impact they have on each other if the disk usage is very high.
diff --git a/lib/hypervisor/hv_kvm/__init__.py b/lib/hypervisor/hv_kvm/__init__.py
index a2da25b..5a802db 100644
--- a/lib/hypervisor/hv_kvm/__init__.py
+++ b/lib/hypervisor/hv_kvm/__init__.py
@yiannist
yiannist / mocked-ext.json
Created June 13, 2017 13:24
A (reduced) input file that causes hail to fail with FailN1 in ganeti 2.16
{
"cluster_name": "ok0.dev.okeanos.grnet.gr",
"cluster_tags": [],
"enabled_hypervisors": [
"kvm"
],
"instances": {
"snf-89": {
"admin_state": "down",
"disk_space_total": 20608,
@yiannist
yiannist / nfq_test.py
Created October 28, 2016 21:48
Test python-nefilterqueue exposing HW addrs
from netfilterqueue import NetfilterQueue
import struct
def print_and_accept(pkt):
print(pkt)
print("Addr: %x:%x:%x:%x:%x:%x(:%x:%x)" %
struct.unpack("BBBBBBBB", pkt.get_hw()))
print
pkt.accept()
@yiannist
yiannist / gist:4546899
Last active August 5, 2019 15:16
Simple Haskell word wrap
wrap :: Int -> String -> [String]
wrap maxWidth text = reverse (lastLine : accLines)
where (accLines, lastLine) = foldl handleWord ([], "") (words text)
handleWord (acc, line) word
-- 'word' fits fine; append to 'line' and continue.
| length line + length word <= maxWidth = (acc, word `append` line)
-- 'word' doesn't fit anyway; split awkwardly.
| length word > maxWidth =
let (line', extra) = splitAt maxWidth (word `append` line)
in (line' : acc, extra)
@yiannist
yiannist / test_ba.ll
Created September 17, 2012 16:42
Label address (taken with blockaddress) not exported to .s
define {i64, i64, i64} @zip.get_cd_loop.5(i64 %hp_in, i64 %p_in, i64 %v19, i64 %v20, i64 %v21, i64 %v22, i64 %v23) nounwind noredzone {
Entry:
%exception_sync = alloca double
%hp_reg_var = alloca i64
store i64 %hp_in, i64* %hp_reg_var
%p_reg_var = alloca i64
store i64 %p_in, i64* %p_reg_var
%vr23 = alloca i64
%vr22 = alloca i64
%vr21 = alloca i64
@yiannist
yiannist / stats.erl
Created April 19, 2012 08:56
Compare flunctuation of different timing methods
-module(stats).
-compile(export_all).
%%================================================================
%% Statistics data structures
%%================================================================
-record(range, {min, max}).
@yiannist
yiannist / diff after baldrick's comments
Created February 23, 2012 15:36
Add volatile load/store support in llvm-c bindings
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h
index 3ffaddd..69c8d30 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -949,7 +949,11 @@ LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef, LLVMTypeRef Ty,
LLVMValueRef LLVMBuildFree(LLVMBuilderRef, LLVMValueRef PointerVal);
LLVMValueRef LLVMBuildLoad(LLVMBuilderRef, LLVMValueRef PointerVal,
const char *Name);
+LLVMValueRef LLVMBuildVolatileLoad(LLVMBuilderRef, LLVMValueRef PointerVal,
+ const char *Name, LLVMBool isVolatile);
@yiannist
yiannist / Ant.hs
Created November 29, 2011 23:09 — forked from mzero/Ant.hs
monadic ants
module Ant
where
import Prelude hiding (log)
import Control.Monad ((>=>))
import Data.List ((\\))
-- | A Simple logging Monad that logs items of type e