Skip to content

Instantly share code, notes, and snippets.

View joelverhagen's full-sized avatar

Joel Verhagen joelverhagen

View GitHub Profile
@joelverhagen
joelverhagen / LibGit2SharpPerformance.cs
Last active August 29, 2015 14:00
Performance tests of LibGit2Sharp "git add" and "git commit" versus the standard "git.exe".
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
using LibGit2Sharp;
namespace LibGitTest
{
internal class Program
@joelverhagen
joelverhagen / Demo.cs
Last active August 29, 2015 14:12
Convert a Try... function in C# to a Get... function.
// Try it out: http://ideone.com/Aubx5H
using System;
namespace Knapcode.KitchenSink.Extensions
{
public static class UniversalExtensions
{
public delegate bool TryGetValue<in TInput, TOutput>(TInput input, out TOutput value);
@joelverhagen
joelverhagen / uc_codes.json
Created March 30, 2012 07:11
List of Various University of Cincinnati Codes
{
"BoK Codes": {
"Diversity & Culture": "DC",
"English Composition": "EC",
"Fine Arts": "FA",
"Historical Perspectives": "HP",
"Humanities": "HU",
"Literature": "LT",
"Natural Sciences": "NS",
"Quantitative Reasoning": "QR",
@joelverhagen
joelverhagen / count-occurrences.js
Created August 10, 2012 16:24
Requires DelimEmitter from my Loggie project.
"use strict";
var DelimEmitter = require("./delimemitter").DelimEmitter;
exports.countInString = function(haystack, needle) {
var count = 0;
var position = 0;
while(true) {
position = haystack.indexOf(needle, position);
if(position !== -1) {
@joelverhagen
joelverhagen / generate_cert.sh
Created August 10, 2012 16:46
A nice helper script for generating a self-signed certificate. Great for getting HTTPS running on a home server.
#!/bin/bash
# ensure the script is running as root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root." 1>&2
exit 1
fi
NAME=${1:-self-signed}
@joelverhagen
joelverhagen / craigslist_locations.sql
Created October 16, 2012 05:14
A SQL schema of all regions, states, and locations (cities) that Craigslist supports, as of October 16, 2012. This data was originally made for PostgreSQL. This data is fetched from http://www.craigslist.org/about/sites.
CREATE TABLE regions (
region_id integer NOT NULL,
name character varying(255) NOT NULL
);
CREATE TABLE states (
state_id integer NOT NULL,
region_id integer NOT NULL,
name character varying(255) NOT NULL
);
@joelverhagen
joelverhagen / hangman.py
Created October 31, 2012 04:47
Solve Dan's hangman puzzle. This is cludgy code. Please disregard.
# digraphs, sorted by how common they are in the english language
digraphs = ['th', 'he', 'in', 'er', 'an', 're', 'on', 'at', 'en', 'nd', 'st', 'or', 'te', 'es', 'is', 'ha', 'ou', 'it', 'to', 'ed', 'ti', 'ng', 'ar', 'se', 'al', 'nt', 'as', 'le', 've', 'of', 'me', 'hi', 'ea', 'ne', 'de', 'co', 'ro', 'll', 'ri', 'li', 'ra', 'io', 'be', 'el', 'ch', 'ic', 'ce', 'ta', 'ma', 'ur', 'om', 'ho', 'et', 'no', 'ut', 'si', 'ca', 'la', 'il', 'fo', 'us', 'pe', 'ot', 'ec', 'lo', 'di', 'ns', 'ge', 'ly', 'ac', 'wi', 'wh', 'tr', 'ee', 'so', 'un', 'rs', 'wa', 'ow', 'id', 'ad', 'ai', 'ss', 'pr', 'ct', 'we', 'mo', 'ol', 'em', 'nc', 'rt', 'sh', 'po', 'ie', 'ul', 'im', 'ts', 'am', 'ir', 'yo', 'fi', 'os', 'pa', 'ni', 'ld', 'sa', 'ay', 'ke', 'mi', 'na', 'oo', 'su', 'do', 'ig', 'ev', 'gh', 'bl', 'if', 'tu', 'av', 'pl', 'wo', 'ry', 'bu', 'iv', 'ab', 'ia', 'vi', 'ex', 'op', 'bo', 'fe', 'ag', 'ci', 'da', 'mp', 'tt', 'sp', 'ck', 'ty', 'fr', 'ei', 'ap', 'rd', 'gr', 'od', 'ef', 'go', 'ba', 'ey', 'cl', 'cr', 'ov', 'ht', 'rn', 'fa', 'ls', 'gi'
@joelverhagen
joelverhagen / README.md
Created February 17, 2012 04:27
Jekyll JSON Filter

This is a plugin meant for Jekyll.

This filter is described at the Shopify Liquid wiki, but somehow didn't make it into the general repository.

Just plop this guy in your _plugins directory and use it like this:

var title = {{ page.title | json }};
info : Restoring packages for C:\Users\jver\Desktop\Test\errors\ConsoleApp1\src\ConsoleApp1\project.json...
error: System.Console 4.0.0-beta-23516 provides a compile-time reference assembly for System.Console on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Threading 4.0.11-beta-23516 provides a compile-time reference assembly for System.Threading on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Dynamic.Runtime 4.0.0 provides a compile-time reference assembly for System.Dynamic.Runtime on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Linq.Expressions 4.0.0 provides a compile-time reference assembly for System.Linq.Expressions on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.
error: System.Security.Cryptography.Algorithms 4.0.0-beta-23516 provides a compile-time reference assembly for System.Security.Cryptography.Algorithms on D
info : Restoring packages for C:\Users\jver\Desktop\Test\errors\ConsoleApp1\src\ConsoleApp1\project.json...
info : Installing System.Security.Cryptography.Encryption 4.0.0-beta-23109.
info : Installing System.Reflection.Primitives 4.0.0-beta-23109.
info : Installing System.Reflection 4.0.0-beta-23109.
info : Installing System.Globalization 4.0.0-beta-23109.
info : Installing System.Private.Uri 4.0.0-beta-23109.
info : Installing System.Diagnostics.Debug 4.0.0.
info : Installing System.Private.Uri 4.0.1-beta-23516.
info : Installing System.Security.SecureString 4.0.0-beta-23109.
info : Installing System.Threading.ThreadPool 4.0.10-beta-23109.