Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / DisableSecureScreensaver.reg
Created December 2, 2010 21:25
Forcably disable the screensaver password, even if the Group Policy is forcing it on you
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop]
"ScreenSaverIsSecure"="0"
@PProvost
PProvost / Lua Resource Pools.lua
Created November 3, 2010 19:31
A simple resource pool implementation in lua
-- Replace this function with your "new" function
local function NewItem()
return { }
end
-- Storage of released items
local pool = {}
-- Get/create a new item
local function Acquire()
@PProvost
PProvost / gist:655093
Created October 30, 2010 08:20
[PS1] Fixup AVI Names with Regex
ls *.avi | % {
if( $_.Name -match "futurama-2(\d\d)-amc.avi") {
ren $_ Futurama.S02E$($Matches[1])-amc.avi
}
}
@PProvost
PProvost / WeaselSim.lua
Created May 1, 2010 08:28
A lua solution to the weasel algorithm
--[[
-- Lua solution to the Weasel Program
-- by Peter Provost <pprovost_at_gmail_dot_com>
-- See: http://en.wikipedia.org/wiki/Weasel_program
-- Alternate language solutions: http://rosettacode.org/wiki/Evolutionary_algorithm#Python
--]]
local target = "METHINKS IT IS LIKE A WEASEL"
local alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
local c, p = 100, 0.06
# Git functions
# Mark Embling (http://www.markembling.info/)
# Is the current directory a git repository/working copy?
function isCurrentDirectoryGitRepository {
if ((Test-Path ".git") -eq $TRUE) {
return $TRUE
}
# Test within parent dirs
@PProvost
PProvost / gist:292357
Created February 2, 2010 04:19
How to tunnel through Putty with RDP
RDP Tunneling via Putty and SSH
1. Putty to the external address using ssh (e.g. yourmachine.dyndns.org)
2. Figure out the IP address of the machine inside your network that you want to connect to
e.g. 192.168.1.110
3. Open putty settings and add the following to the tunnels section
Source: 3333
Destination:192.168.1.110:3389