Skip to content

Instantly share code, notes, and snippets.

Test-driving things

Per Rovegård provegard

Test-driving things
View GitHub Profile
provegard / notify-up.service
Created Jun 17, 2018
Systemd boot service for calling
View notify-up.service
Description=Sends SMS to notify about system coming up
test -n "$dest" || exit 1
read text
while test $retries -gt 0 -a $cont -ne 0; do
provegard /
Last active Jun 17, 2018
Script for sending sms on server start
set -x
msg="$SERVER has started."
shutdown_dt=$(last -x --time-format iso |grep shutdown | head -n 1 | awk '{print $7}')
if [ -n "$shutdown_dt" ]; then
msg="$msg Shutdown at $shutdown_dt"
provegard / NUnitNSpec.cs
Last active Dec 30, 2016
Testing adapter that makes it possible to run NSpec-based tests using an NUnit runner.
View NUnitNSpec.cs
// Obsolete, see
provegard /
Created Jun 20, 2015
Collect IVT490 readings
#!/usr/bin/env python
#pylint: indent-string=' '
import serial
import daemon
import signal
import lockfile
import time
import getopt
import os
provegard /
Last active Dec 3, 2022
Python script for dumping wallet addresses and private keys
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
# Usage:
# ./ <wallet binary>
provegard / HowToUse_Dll.cpp
Last active Dec 21, 2015
MediaInfo buffer usage
View HowToUse_Dll.cpp
/* Copyright (c) SARL. All Rights Reserved.
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
// Linux: g++ -o howtouse HowToUse_Dll.cpp -lmediainfo -lzen -ldl
// Windows: cl /Fehowtouse.exe HowToUse_Dll.cpp
provegard / blanket_jasmine.js
Last active Dec 10, 2015
Sample code to illustrate some issues with Blanket
View blanket_jasmine.js
/*! blanket - v1.0.1 */
Copyright (C) 2012 Ariya Hidayat <>
Copyright (C) 2012 Mathias Bynens <>
Copyright (C) 2012 Joost-Wim Boekesteijn <>
Copyright (C) 2012 Kris Kowal <>
Copyright (C) 2012 Yusuke Suzuki <>
Copyright (C) 2012 Arpad Borsos <>
Copyright (C) 2011 Ariya Hidayat <>
provegard / AsyncTester.cs
Created May 7, 2012
Sync context for testing async background workers
View AsyncTester.cs
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading;
// Custom synchronization context for testing asynchronous background workers.
// See for the full story!
public class AsyncTester : SynchronizationContext, IDisposable
private readonly int _timeoutMs;
provegard / Meh.cs
Created Jan 18, 2012
Extension method for calculating the usable client area of a control
View Meh.cs
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
public static class Meh
private static readonly IDictionary<DockStyle, Func<Control, Point>> DockAdjusters = new Dictionary<DockStyle, Func<Control, Point>>