Skip to content

Instantly share code, notes, and snippets.

Avatar
Test-driving things

Per Rovegård provegard

Test-driving things
View GitHub Profile
@provegard
provegard / notify-up.service
Created Jun 17, 2018
Systemd boot service for calling notify-up.sh
View notify-up.service
[Unit]
Description=Sends SMS to notify about system coming up
After=network.target
[Service]
ExecStart=/usr/local/bin/notify-up.sh
Type=oneshot
[Install]
WantedBy=default.target
View send-sms.sh
#/bin/sh
dest=$1
test -n "$dest" || exit 1
read text
user=`whoami`
retries=5
cont=1
while test $retries -gt 0 -a $cont -ne 0; do
@provegard
provegard / notify-up.sh
Last active Jun 17, 2018
Script for sending sms on server start
View notify-up.sh
#!/bin/bash
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"
fi
@provegard
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 https://github.com/provegard/NSpecInNUnit
@provegard
provegard / ivt490d.py
Created Jun 20, 2015
Collect IVT490 readings
View ivt490d.py
#!/usr/bin/env python
#pylint: indent-string=' '
import serial
import daemon
import signal
import lockfile
import time
import getopt
import os
@provegard
provegard / dump_wallet_addresses.py
Last active Jun 1, 2021
Python script for dumping wallet addresses and private keys
View dump_wallet_addresses.py
#!/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:
# ./dump_wallet_addresses.py <wallet binary>
#
@provegard
provegard / HowToUse_Dll.cpp
Last active Dec 21, 2015
MediaInfo buffer usage
View HowToUse_Dll.cpp
/* Copyright (c) MediaArea.net 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
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 <ariya.hidayat@gmail.com>
Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
@provegard
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 http://int.li/15 for the full story!
public class AsyncTester : SynchronizationContext, IDisposable
{
private readonly int _timeoutMs;
@provegard
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>>
{