Skip to content

Instantly share code, notes, and snippets.

View crosbymichael's full-sized avatar

Michael Crosby crosbymichael

View GitHub Profile
@crosbymichael
crosbymichael / gist:1686407
Created January 27, 2012 01:46
ObjectMapper
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace MVVM_Async.Helpers
{
public static class ObjectMapper
{
@crosbymichael
crosbymichael / gist:1913344
Created February 26, 2012 05:17
Get mac address
string macAddress = (from iface in NetworkInterface.GetAllNetworkInterfaces()
where iface.OperationalStatus == OperationalStatus.Up
select iface).FirstOrDefault().GetPhysicalAddress().ToString();
@crosbymichael
crosbymichael / gist:1969911
Created March 4, 2012 01:50
ZenORM C# Framework
config = ZenOrmConfig.Instance;
config.DataStore = DataStoreType.MySQL;
config.DataStoreConfig = new ZenORM.Config.MySqlConfig();
config.Debug = true;
Video video = new Video {
Director = "Steven",
NumberOfCast = 30,
Title = "ET",
@crosbymichael
crosbymichael / index.py
Created July 15, 2012 00:14
Web.py Boilerplate
#!/usr/bin/env/ python
import web
urls = ('/', 'Index')
application = web.application(urls, globals())
web.config.debug = True
class Index:
@crosbymichael
crosbymichael / gist:3521509
Created August 30, 2012 01:38
Disable Java in Firefox
package main
import (
"fmt"
"io/ioutil"
"os"
"os/user"
"path"
"strings"
)
@crosbymichael
crosbymichael / gist:4022139
Created November 6, 2012 02:19
Fab deployment
#!/usr/bin/env python
from fabric.api import *
from datetime import datetime as dt
"""
Deployment Fabric File for codeassistant-django
"""
env.hosts = ['192.168.1.21']
@crosbymichael
crosbymichael / gist:5333646
Created April 8, 2013 01:59
Atom and rss parser
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"time"
)
@crosbymichael
crosbymichael / monitor.go
Created May 2, 2013 11:28
Go directory monitor Not enterprise ready, need more XML...
package main
import (
"encoding/json"
"flag"
"fmt"
zmq "github.com/alecthomas/gozmq"
"github.com/howeyc/fsnotify"
"log"
"sync"
@crosbymichael
crosbymichael / server.go
Created May 26, 2013 02:38
Quick and simple static file server in Go. No more python -m SimpleHttpServer
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
)
import os.path
CONF_ROOT = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'sentry', # Or path to database file if using sqlite3.
'USER': 'sentry', # Not used with sqlite3.
'PASSWORD': 'sentry', # Not used with sqlite3.