Skip to content

Instantly share code, notes, and snippets.

View nathanpjones's full-sized avatar

Nathan Jones nathanpjones

View GitHub Profile
@nathanpjones
nathanpjones / Example.cs
Last active August 6, 2018 13:54
Monitored Lock
/*
* This is an example console application to illustrate the usage
* of the MonitoredLock class and technique.
*/
using System;
using System.Diagnostics;
using System.Threading;
namespace MonitoredLock
{
@nathanpjones
nathanpjones / GitDiff.sh
Last active October 20, 2016 03:16
Git script to route diff handling to different applications based on file extension
#!/bin/sh
NULL="/dev/null"
# $1 = $LOCAL
# $2 = $REMOTE
# $3 = $MERGED
# get file extension in lowercase for selecting comparison tool
filename=$(basename "$1")
extension=$(echo "${filename##*.}" | awk '{print tolower($0)}');
@nathanpjones
nathanpjones / python_as_pi.sh
Created February 21, 2016 20:29
Run Python as Root
#!/usr/bin/env bash
DIR=$(dirname $(readlink -f "${BASH_SOURCE}"))
if [ ! -f $DIR/venv/bin/python ]; then
echo "This script should be located in the project root directory"
echo "and the virtual environment should be created."
else
# Change python back to run as pi
@nathanpjones
nathanpjones / Input-Output-Go-WPF-GUI-Template.linq
Created September 6, 2019 18:15 — forked from sinairv/Input-Output-Go-WPF-GUI-Template.linq
LinqPad Input-Output-Go WPF GUI Template
enum TextBoxMode
{
SingleLine,
MultiLine
}
TextBox CreateTextBox(string label, TextBoxMode textBoxMode)
{
var lbl = new Label();
lbl.Content = $"{label}:";