Skip to content

Instantly share code, notes, and snippets.

View cee-dub's full-sized avatar

Cameron Walters (cee-dub) cee-dub

View GitHub Profile
@cee-dub
cee-dub / nginx.conf
Created January 15, 2012 01:15
Homebrew formula to load Nginx listening on standard ports with convenient user-land configuration.
user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
@cee-dub
cee-dub / org.nginx.nginx.plist
Created January 15, 2012 01:50
Generic LaunchDaemon plist for Nginx
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.nginx.nginx</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
@cee-dub
cee-dub / postgres_timestamp_defaults.rb
Created January 29, 2012 20:53
Convenient methods to let PostgresQL manage created/updated_at
require 'active_support/core_ext/string/filters'
module PostgresTimestampDefaults
def add_timestamp_defaults(table_name)
add_default_now(table_name, :created_at)
add_default_now(table_name, :updated_at)
add_updated_at_trigger(table_name)
end
def add_default_now(table_name, column_name)
@cee-dub
cee-dub / brew-services.rb
Created September 26, 2012 04:15 — forked from bryanveloso/brew-services.rb
External script for homebrew to simplify starting services via launchctl, out of the box support for any formula which implements #startup_plist. (This version fixes the deprecation warning raised on Formula.resolve_alias.)
#!/usr/bin/env ruby -w
# brew-services(1) - Easily start and stop formulas via launchctl
# ===============================================================
#
# ## SYNOPSIS
#
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>
@cee-dub
cee-dub / sse.go
Created May 30, 2014 21:08
Simple Golang SSE example using CloseNotifier
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// SSE writes Server-Sent Events to an HTTP client.
@cee-dub
cee-dub / keybase.md
Created September 18, 2015 01:23
keybase.md

Keybase proof

I hereby claim:

  • I am cee-dub on github.
  • I am ceedub (https://keybase.io/ceedub) on keybase.
  • I have a public key whose fingerprint is 4FE7 0A9E F882 8393 C2F3 802D 8080 0A91 52B3 77B9

To claim this, I am signing this object:

@cee-dub
cee-dub / orderedlogger.go
Created July 10, 2020 16:37
Basic ordered JSON logger inspired by go-kit
package olog
import (
"encoding"
"encoding/json"
"fmt"
"github.com/go-kit/kit/log"
"github.com/mickep76/mapslice-json"
)