Skip to content

Instantly share code, notes, and snippets.

View tracker1's full-sized avatar

Michael J. Ryan tracker1

View GitHub Profile
@tracker1
tracker1 / package.json
Created August 20, 2012 18:18
Setting the current date/time in windows.
{
"name":"update-dtm"
,"version":"0.1.0"
,"dependencies":{
"request":"2.x.x"
}
,"devDependencies":{}
}
@tracker1
tracker1 / sqltext.coffee
Created September 14, 2012 22:53
Module exports in coffeescript
# Without the anonymous function wrapper, it seemed to only export the first value.
(->
exports.getTopOfQueue = """
SELECT TOP 10
[Id],[CreatedOn],[LastAttemptOn],[Application],[Class],[From],[To],[Subject],[BodyUrl],[BodyHtml],[JsonDetails]
FROM [EmailQueue]
WHERE [LastAttemptOn] < DATEADD(m, -15, SYSUTCDATETIME())
ORDER BY [Id]
"""
@tracker1
tracker1 / CardReader.js
Created November 29, 2012 18:14
Wrapping an external service...
var EventEmitter = require("events").EventEmitter;
var util = require("util");
module.exports = CardReader;
//the export is essentially a self-healing wrapper around the external interface...
function CardReader() {
var that = this, someProc = null;
loadProc();
function loadProc() {
@tracker1
tracker1 / _Layout.cshtml
Created April 29, 2013 19:11
CSHTML Layout to get model/view/controller names into the document...
@functions{
string currentController = null;
string currentAction = null;
string currentModel = null;
private void InitVars() {
ViewBag.Phone = phone;
currentController = ViewContext.RouteData.Values["Controller"].ToString().ToLower();
currentAction = ViewContext.RouteData.Values["Action"].ToString().ToLower();
@tracker1
tracker1 / UnityUtil.cs
Created May 30, 2013 01:13
Below is an example of creating a generic WCF Service Client from the interface base, as well as an extension method for Unity.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
using System.Configuration;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Runtime.Serialization;
@tracker1
tracker1 / TestUtility.cs
Last active December 19, 2015 03:08
Create an Entity Framework context bound to a model against an empty SQL Compact Edition (SQL CE) database file, for purposes of repository testing.
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Entity;
using System.Data.EntityClient;
using System.Data.Metadata.Edm;
using System.Data.SqlServerCe;
using System.IO;
using System.Linq;
using System.Reflection;
@tracker1
tracker1 / DockerCheatSheet.sh
Last active December 28, 2015 22:19
DockerCheatSheet - update for docker 0.7.0
base image tracker1/nodejs -- ubuntu 12.04 w/ python 2.7, build tools and nodejs 0.10.22
build docker app, from app dir :tagname
sudo docker build -t tracker1/nodejs-demo:1 .
run docker app in bg / -p ### will create random forward for port X
-d is daemon mode, or & at the end for background
sudo docker run -d -name demo1 tracker1/nodejs-demo:1
@tracker1
tracker1 / router-admin-scripts.sh
Created November 26, 2013 09:03
Tomato Router - Limit Guest Wifi
#Setup bridge for guest wifi (br1) with separate subnet/dhcp
# setup virtual wifi wlan0.1
#the following rules go under administration -> scripts -> firewall then reboot after saving
#NOTE: -I inserts at the beginning be default, so restrictive rules at the top, permissive at the bottom.
#default deny guest
iptables -I FORWARD -i br1 -j DROP
#Removes guest access to physical network
@tracker1
tracker1 / etc-network-interfaces
Created February 7, 2014 01:12
network config, multiple ips for a single interface.
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0