Skip to content

Instantly share code, notes, and snippets.

View aggieben's full-sized avatar
🏠
Working from home

Ben Collins aggieben

🏠
Working from home
View GitHub Profile
@aggieben
aggieben / NLog.config
Created July 8, 2012 22:59
Skeletal Windows Service which blocks on NLog
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="Debugger" name="debugger_target" />
<target xsi:type="Chainsaw" name="chainsaw_target" address="udp4://localhost:4141"/>
<!--
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
var tags = new []{"adsf", "qwer", "zxcv", "uipo", "nm.,"};
var tagLookup = new Dictionary<string, int>();
var random = new Random();
foreach (var i in Enumerable.Range(1,35000))
{
// var guid = Guid.NewGuid().ToString();
// tagLookup.Add(guid.Substring(guid.IndexOf('-'), 14).Replace('-','\0').ToLower(), i);
var key = new string(Enumerable.Repeat("abcdefghijklmnopqrstuvwxyz", 8).Select(s => s[random.Next(s.Length)]).ToArray());
void Main()
{
// Write code to test your extensions here. Press F5 to compile and run.
}
public static class MyExtensions
{
// Write custom extension methods here. They will be available to all queries.
public static double Std(this IEnumerable<double> src)
{
@aggieben
aggieben / stacktrello.user.js
Last active December 18, 2015 16:29
A simple UserScript that adds a 'trello' link to meta.* StackExchange posts to allow the user to rapidly create a trello card from the post. The purpose of this is to make SE sites even more useful as a bug-tracking / community management tool.For a brief screencast, see: http://youtu.be/AUJ27ISlTVI
// ==UserScript==
// @name StackTrello
// @author Benjamin Collins <ben.collins@acm.org>
// @namespace https://gist.github.com/aggieben
// @downloadURL https://gist.github.com/5811685/raw/stacktrello.user.js
// @updateURL https://gist.github.com/5811685/raw/stacktrello.user.js
// @version 0.0.4
// @downloadURL ttps://gist.github.com/aggieben/5811685/raw/stacktrello.user.js
// @updateURL ttps://gist.github.com/aggieben/5811685/raw/stacktrello.user.js
// @description Script to render a link that will create a new trello card from a StackExchange site post
/*
A = array(1, 3, 5, null, null, null);
B = array(2, 4, 6);
merge_sort(A, B);
console.log(B)
>> (1,2,3,4,5,6)
*/
Function Ensure-Module {
Param([string]$name)
if (-not (Get-Module -name $name)) {
if (Get-Module -ListAvailable |? { $_.name -eq $name }) {
Import-Module -Name $name
$true #if available, then import
}
} else {
$false #not loaded, not available
@aggieben
aggieben / TestEmail.ps1
Created September 5, 2012 19:55
Send email with PowerShell
$mail = New-Object System.Net.Mail.SmtpClient("smtp.geusnet.com", 25)
$mail.Send("aggieben@gmail.com", "bcollins@praecoemailtest.cloudap...", "testing kato", "blah")
// ==UserScript==
// @name Co-Op Spotter
// @namespace https://gist.github.com/aggieben
// @downloadURL https://gist.github.com/raw/3094482/coopspotter.user.js
// @updateURL https://gist.github.com/raw/3094482/coopspotter.user.js
// @description Script to audibly alert the user to changes in the main content div of Harvest Co-op.
// @match http://*coopapp.com/*
// @match https://*coopapp.com/*
// @resource alertSound http://goo.gl/IDn7c
// @resource alertSoundAll http://goo.gl/sQgvK
@aggieben
aggieben / harvest-growler.user.js
Created July 11, 2012 22:01 — forked from aschempp/harvest-growler.user.js
Fluid userscript for Harvest CO-OP Timer app. Pops a Growl notification every so often to remind me to track my hours if no timer is currently running.
// ==UserScript==
// @name CO-OP Timer Growl Reminder
// @namespace http://coopapp.com
// @description Displays Growl notifications at a user defined interval, reminding you to track your time.
// @include *
// @author Andreas Schempp
// @author Mike Green
// @version 0.1.1
// ==/UserScript==
@aggieben
aggieben / codeeval.hpp
Created May 31, 2012 18:51
CodeEval Library
#include <cmath>
#include <memory>
#include <numeric>
#include <string>
#include <vector>
typedef std::auto_ptr<std::vector<std::string> > token_collection_t;
token_collection_t tokenize(const std::string &s, const char token = ',')
{