Skip to content

Instantly share code, notes, and snippets.

View lobeck's full-sized avatar

Christian Becker lobeck

View GitHub Profile
#!/usr/bin/env python3
"""
Create LVM snapshot and mount or remove
"""
import argparse
import os
import subprocess
# -*- coding: utf8 -*-
import argparse
import csv
from datetime import datetime
"""
Calculate amount similar to comdirects Wechselgeldsparen out of American Express ofx.csv files
You need to do the transfer on your own, but at least it will calculate the amount.
"""
parser = argparse.ArgumentParser(description='Calculate fractions amount for AMEX CSV statements')
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@lobeck
lobeck / README.md
Last active April 20, 2018 00:14
Synology WD RED WD60EFRX queue workaround

I've recently switched my NAS drives to WD RED 6TB (WD60EFRX). Already during rebuild I've noticed a very bad performance of ~37 MB/s.

My first stop was the usual /proc/sys/dev/raid/speed_limit_max, however this turned out to be 200 MB/s, which is fine. I've also checked various other settings without any result.

Closer inspection of iostat showed 100% disk utilization which was weird, but also explained why none of the other settings had any performance effect.

A [blog post][1] recommended disabling NCQ which seemed very odd to me, but desperate times, desperate measures. In order to eventually revert this, i've noticed that the value for a WD RED 3TB (WD30EFRX) is 31, however the 6 TB drives has a value of 1.

This seemed like a bingo! When increasing the 6 TB drive to 31 too, throughput immediately jumped to ~170 MB/s which is the value i was looking for. Once the rebuild went through I wanted to verify this, especially since Synology recommends a reboot after adding certain drives which I haven't done

@lobeck
lobeck / fcnctl.txt
Last active March 10, 2016 02:07
how to lock a TimeMachine sparsebundle on a linux host eg. when using netatalk
this is the actual syscall made by netatalk:
fcntl(7, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=9223372036854775799, len=1} ) = 0
@lobeck
lobeck / gist:25046e579b337416e65c
Created November 13, 2015 22:14
kickstart file using two disks and btrfs without a partition table
# disk 1: /boot and swap
# disk 2: btrfs without partitions
#
# the %pre section will create the brtfs filesystem, the label passed by -L is used to trick anaconda so it will find the filesystem
# the part statement below does actually nothing but is required for the subvolumes to be created
# otherwise there would be parse errors and anaconda would refuse the installation
#
part btrfs.10 --fstype=btrfs --noformat --label=docker --onpart=LABEL=docker
btrfs / --subvol --name=root docker
btrfs /var/log --subvol --name=varlog docker
@lobeck
lobeck / port_http_test.c
Last active November 3, 2015 16:30
port_http parse test case
#include <string.h>
#include<stdio.h>
#include <stdlib.h>
char *mumu_string_replace(char *source, int *length, int can_realloc, char *toreplace, char *replacement)
{
char *pospattern;
char *reallocresult;
char *tempstring=NULL;