Skip to content

Instantly share code, notes, and snippets.

View mbbx6spp's full-sized avatar
🎯
Focusing

Susan Potter mbbx6spp

🎯
Focusing
View GitHub Profile
DROP DATABASE IF EXISTS animalsdb;
CREATE DATABASE animalsdb;
\c animalsdb;
-- We're modeling the following Haskell datatype:
--
-- data Animal = Cat Name Age | Dog Name OwnerId
--
-- We're going to factor the common 'Name' field into the animal table.
@mbbx6spp
mbbx6spp / church-numerals.scala
Last active April 13, 2017 15:09 — forked from tommysullivan/church-numerals.scala
A fork for a friend's Gist to demonstrate some things
/*
SP: currying this gives the type: (T => T) => T => T
That looks an awful lot like Haskell's application ($) operator. :)
There is a higher order abstraction here, sniff it out.
*/
type ChurchNumeral[T] = (T => T, T) => T
def cn0[T](f:T=>T, x:T):T = x
def cn1[T](f:T=>T, x:T):T = f(x)
def cn2[T](f:T=>T, x:T):T = f(f(x))
@mbbx6spp
mbbx6spp / README.md
Last active August 29, 2015 13:56 — forked from netj/memusg

time for memory

How is there not a standard tool for this already? Bogus.

Tonight I'll rewrite the above shell script in C because it makes no sense to not write something so simple in C and package it up and distribute (at least for Linux and Darwin which is what I care about most).

*<RANT> Also note I begrudgingly add this for Darwin only because every dev I work with at work uses it. Hate it. Pointless when deploying to other NIXes. Why? </RANT>

#!/bin/sh
# Your Zenoss server settings.
ZENOSS_URL="http://localhost:8080"
ZENOSS_USERNAME="admin"
ZENOSS_PASSWORD="zenoss"
# Generic call to make Zenoss JSON API calls easier on the shell.
zenoss_api () {
ROUTER_ENDPOINT=$1
@mbbx6spp
mbbx6spp / gist:4043507
Created November 9, 2012 03:19 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
grep -v 'pr/' |
xargs -L1 |
sed 's|origin/||' |
xargs git push origin --delete
@mbbx6spp
mbbx6spp / notify_when.rb
Created September 18, 2012 18:27 — forked from pmarreck/notify_when.rb
NotifyWhen, a Ruby module you can extend any object with to get on-the-fly tracing of any later method calls on it
# So you want to find out what is messing with your object somewhere deep in your stack...
# Behold, your on-the-fly tracer...
# Updated this so it break in pry which would be more useful to look at state not in arguments of called method.
module NotifyWhen
require 'pry'
def notify_when(*meths, &callback)
class << self; self; end.instance_eval do
@mbbx6spp
mbbx6spp / ideal ops.md
Created May 30, 2012 18:11 — forked from bhenerey/ideal ops.md
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan

@mbbx6spp
mbbx6spp / gist:1083536
Created July 14, 2011 21:45 — forked from onethirtyfive/gist:1083182
Class-Table Inheritance Meta-model for DataMapper
# Module with mixins for common queries across descendants:
module Descendant
# I guess I could use ActiveSupport::Concern here...
def self.included(receiver)
receiver.extend ClassMethods
receiver.send :include, InstanceMethods
end
module ClassMethods
def self.included(receiver)