Skip to content

Instantly share code, notes, and snippets.

@mguentner
mguentner / pure.nix
Created August 20, 2017 20:43
nix config for anonymous ftp with pure-ftpd
{
systemd.services.pure-ftpd = {
description = "PureFTPD Server";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
# -e only Anon -M allow Dirs
ExecStart = "${pkgs.pure-ftpd}/bin/pure-ftpd -e -M -p 30000:50000";
Type = "simple";
};
};
@mguentner
mguentner / concurrentadd.go
Last active August 16, 2017 14:18
Minimal test case for IPFS concurrent add
// run with ./concurrentadd --dir where/your/testfiles/reside
package main
import (
"flag"
"log"
"os"
"io/ioutil"
"github.com/ipfs/go-ipfs-api"
"path/filepath"
@mguentner
mguentner / configuration.nix
Created April 15, 2016 16:34
config / test environment for mysql nix issue / long_init_db.sql stolen from http://stackoverflow.com/questions/5125096/for-loop-example-in-mysql#5126655
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
require 'json'
file = File.read("chains.json")
data = JSON.parse(file)
unknowncount = 0
for effect in data
filename = ""
for element in effect
if element.class == String
#!/usr/bin/env python3
#
# This file is part of cannelloni, a SocketCAN over Ethernet tunnel.
#
# Copyright (C) 2014-2015 Maximilian Güntner <[email protected]>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2 as
# published by the Free Software Foundation.
#
@mguentner
mguentner / container_performance.cpp
Created November 9, 2014 02:04
Multiset / List sorted
/* Compile with g++ --std=c++11 container_performance.cpp
* Sample output:
* Time for multiset: 13590 ms
* Time for List insert: 620 ms
* Time for List sort: 8989 ms
*/
#include <iostream>
#include <vector>
#include <set>
Checking filesystem on /dev/mapper/ssddecrypt
UUID: 6c0e2db9-5ee5-46df-8596-1d4b4894e94a
checking extents
incorrect offsets 4353 4193
bad block 211019628544
Chunk[256, 228, 0]: length(4194304), offset(0), type(2) is not found in block group
Chunk[256, 228, 4194304]: length(8388608), offset(4194304), type(4) is not found in block group
Chunk[256, 228, 12582912]: length(8388608), offset(12582912), type(1) is not found in block group
Chunk[256, 228, 20971520]: length(8388608), offset(20971520), type(34) is not found in block group
Chunk[256, 228, 29360128]: length(1073741824), offset(29360128), type(36) is not found in block group
[ 1269.994926] BTRFS info (device dm-4): disk space caching is enabled
[ 1270.011609] BTRFS: bdev /dev/mapper/ssddecrypt errs: wr 0, rd 0, flush 0, corrupt 13, gen 0
[ 1270.438137] BTRFS: checking UUID tree
[ 1270.463155] BTRFS critical (device dm-4): corrupt leaf, slot offset bad: block=211019628544,root=1, slot=107
[ 1270.463805] ------------[ cut here ]------------
[ 1270.463849] kernel BUG at fs/btrfs/ctree.c:5236!
[ 1270.463876] invalid opcode: 0000 [#1] PREEMPT SMP
[ 1270.463914] Modules linked in: crc32c_generic btrfs raid6_pq xor xts gf128mul ctr ccm uas usb_storage iTCO_wdt iTCO_vendor_support mousedev snd_hda_codec_analog snd_hda_codec_generic coretemp kvm_intel kvm ppdev microcode evdev mac_hid psmouse serio_raw pcspkr i2c_i801 arc4 btusb pcmcia bluetooth 6lowpan_iphc iwl3945 iwlegacy lpc_ich yenta_socket pcmcia_rsrc pcmcia_core mac80211 i915 snd_hda_intel snd_hda_controller cfg80211 snd_hda_codec snd_hwdep snd_pcm thermal thinkpad_acpi snd_timer wmi nvram drm_kms_helper led_class rfkill snd hwmon
\usepackage{inconsolata}
\usepackage[T1]{fontenc}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\lstset{
numbers=left,
numbersep=5pt,
numberstyle=\tiny\color{mygray},
captionpos=b,
frame=tb,
@mguentner
mguentner / build.sh
Last active August 29, 2015 14:03
Shadow build larger latex documents
#!/bin/bash
# Shadow $TMPDIR...
BASEDIR=$(pwd)
TMPDIR=$(mktemp -d /tmp/texbuild.XXXXXX)
FILES=("refdb.bib" "thesis.tex")
DIRECTORIES=("img" "code" "sections" "data" "data-xen")
if [ ! -d $TMPDIR ]
then
echo "Could not create tmp directory!"
exit 1