Skip to content

Instantly share code, notes, and snippets.

View janw's full-sized avatar

Jan Willhaus janw

View GitHub Profile
@krak3n
krak3n / gist:5884562
Last active March 2, 2019 19:37
Mocking open for ConfigParser.RawConfigParser.readfp() for unit testing.
import io
import six
from mock import patch
from six.moves import configparser as ConfigParser
data = """
[section]
key = value
"""
@Klowner
Klowner / README.txt
Last active March 4, 2017 21:27
Per-user systemd service file for Bittorrent Sync (initially developed for use with the bittorrent-sync from AUR)
Instructions for ArchLinux
- Place btsync@.service in /etc/systemd/system
Then for each user:
- Create a .sync directory in the user's home directory
- Create a config file (eg: /usr/bin/btsync --dump-sample-config > ~/.sync/btsync.json)
- Change options:
"storage_path" : "/home/<username>/.sync"
@RobThree
RobThree / wavefilereader.class.php
Created August 29, 2012 17:22
PHP WAVE file reader / parser
<?php
/**
* WaveFileReader; a simple class to read/parse WAVE file
* (c)2012 Rob Janssen / https://github.com/RobThree
*
* Based on https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
*
* USAGE:
*
* $wav = WaveFileReader::ReadFile('/path/to/test.wav');

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...