Skip to content

Instantly share code, notes, and snippets.

@PProvost
PProvost / gist:1999196
Created March 8, 2012 06:31
MS-Test Async Test Example
[TestMethod]
public async Task MyAsyncTest()
{
var result = await SomeLongRunningOperation();
Assert.IsTrue( result );
}
@PProvost
PProvost / post2md.ps1
Created April 7, 2012 07:49
Converts SubText XML post format to Jekyll-style Markdown
# Config stuff
$pythonExe = "C:\Python\Python32\python.exe"
$html2Text = "C:\dev\github\html2text\html2text.py"
# Load in the category map file
$catMap = @{}
$catFile = [xml] (get-content categories.xml)
$catFile.categories.category | % { $catMap[$_.id] = $_."#text" }
# Builds Jekyll YAML Front Matter string
@PProvost
PProvost / 0001-albino-windows-refactor.patch
Created April 9, 2012 22:46 — forked from rdongxie/0001-albino-windows-refactor.patch
Make Jekyll play nice with Windows again post Albino + posix-spawn refactor
diff --git a/lib/albino.rb b/lib/albino.rb
index 387c8e9..b77d55e 100644
--- a/lib/albino.rb
+++ b/lib/albino.rb
@@ -1,4 +1,5 @@
require 'posix-spawn'
+require 'rbconfig'
##
# Wrapper for the Pygments command line tool, pygmentize.
@PProvost
PProvost / pythonexec.rb
Created April 12, 2012 02:35
Patch to rubypython.rb for Windows to get Octopress's Pygments to work
# Let's add alternative extensions; again, just in case
# blah blah
if FFI::Platform.windows?
# Do this after trying to add alternative extensions,
# since windows install has a python27.a and can cause
# troble.
#
# Some Windows python installers install the DLL in the python directory
# others install in the Windows system directory. So we should search both.
@PProvost
PProvost / Generate-VsSettings.ps1
Created April 19, 2012 06:47
Used to generate VS11 Colors settings for the Solarized theme
<#
.SYNOPSIS
Generate-VsSettings creates a .vssetting file using the Solarized
color pallette created by Ethan Schoonover.
.DESCRIPTION
The Solarized palette was designed by Ethan Schoonover for maximum readability
and contrast. The color choices were chosen based on the highlighting colors
listed in the canonical Vim implementation. For more information see
http://ethanschoonover.com/solarized
@PProvost
PProvost / gist:2583571
Created May 3, 2012 05:41
Powershell convert string to HTML entities
$str = "some long assed string you want to convert"
$str.ToCharArray() | % { "&#{0};" -f [Convert]::ToInt32($_) } | Join-String | clip
@PProvost
PProvost / Start-FileWatcher.ps1
Created May 9, 2012 18:48
Basic file watching in powershell
param(
[string] $rootFolder = ".",
[string] $filter = "*.*"
)
$path = resolve-path $rootFolder -errorAction Stop
write-host "Monitoring $path for changes"
$fsw = new-object System.IO.FileSystemWatcher $path, $filter
$fsw.IncludeSubdirectories = $true
@PProvost
PProvost / AsyncTestExample.cs
Created May 26, 2012 17:24
Simple Example of C# Async Unit Test in VS11
public class SystemUnderTest
{
public Task<string> LongRunningOperation()
{
return Task.Run(() =>
{
Thread.Sleep(2000); // Simulate the long operation
return "Hello there";
});
}
@PProvost
PProvost / gist:6f52133fb7fe8b4cde7d
Created February 12, 2015 04:37
Cron script to clean up Archived episodes in SickBeard
#!/bin/bash
# Source: http://sickbeard.com/forums/viewtopic.php?f=8&t=3945#p19232
SICKBEARD_CONFIG=/var/pvr/sickbeard/config.ini
ECHO=/bin/echo
GREP=/bin/grep
AWK=/usr/bin/awk
MKTEMP=/bin/mktemp
@PProvost
PProvost / PrintrbotPlayToolbelt.scad
Created January 12, 2016 19:41
A remix of Dataman's toolbelt shelf for the Printrbot play
// PrintrBot Play ToolBelt
// 12/6/2016 Dataman, [email protected]
// Rev 1.7
$fn=32;
union() {
radius = 5;