Skip to content

Instantly share code, notes, and snippets.

@bgentry
bgentry / gist:865037
Created March 10, 2011 22:11
Dir.glob_without
class Dir
def self.glob_without(pattern, regexp, directory = pwd)
chdir(directory) do
glob(pattern).reject {|i| i =~ regexp }.map {|i| File.expand_path(i) }
end
end
end
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@ryandotsmith
ryandotsmith / process-partitioning.md
Created April 13, 2012 06:40
Process Partitioning

Process Partitioning

The Problem

When working with large, high volume, low latency systems, it is often the case that processing data sequentially becomes detrimental to the system's health. If we only allow 1 process to work on our data we run into several challenges:

  • Our process may fall behind resulting in a situation which it is impossible for our process to catch up.
  • Our singleton process could crash and leave our system in a degraded state.
  • The average latency of data processing could be dramatically affected by outlying cases.
@danparsons
danparsons / gist:3195652
Created July 29, 2012 01:46
How to stream the London 2012 Olympics

How to stream the London 2012 Olympics

There have been several HOWTOs posted regarding streaming the 2012 Olympics using HTTP / SOCKS proxies via SSH and other similar methods. None of these actually work using the latest Flash on Mountain Lion (with Firefox, Chrome or Safari). Additionally, the third-party streaming sites don't provide BBC's amazing interface, which lets you quickly skip to individual competitors and events. However, setting up an OpenVPN server does work, with some tweaks. You'll get the exact same UX that people in England receive.

@bgentry
bgentry / rated.go
Created October 11, 2012 23:48
Go token bucket rate limiter #golang
package main
import (
"fmt"
"time"
)
func main() {
ticker := rateLimit(4, 10)
@adharris
adharris / postgres_array.go
Created November 28, 2012 19:52
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
@andrew
andrew / railscheck.rb
Last active December 10, 2015 20:59
Check your github account for out of date rails apps
## Rails Upgrade check
#
# Check your github repos for out of date rails apps
#
# usage: $ USERNAME=yourusername PASSWORD=yourpassword ruby railscheck.rb
# or
# usage: $ USERNAME=yourusername PASSWORD=yourpassword ORG=yourorgname ruby railscheck.rb
#
# n.b requires the octokit gem
@icholy
icholy / go_zsh_complete.md
Last active January 9, 2022 19:19
Zsh Tab Completion for Golang

Zsh Tab Completion for Golang

This is pretty specific to my setup but the idea can be adapted to work with pretty much anything.

Go has a flag package which makes parsing command line arguments really easy.

package main
#compdef heroku
# generated from Heroku v2.4.0
# with these plugins: heroku-v3, old_plugins
_heroku() {
local -a app_argument
app_argument=('(-a --app)'{-a,--app}'[application name]:')
_heroku_commands() {
@arenoir
arenoir / group-by.js
Last active March 26, 2016 21:39
Ember group by computed macro
import Ember from 'ember';
var get = Ember.get,
arrayComputed = Ember.arrayComputed;
export default function (dependentKey, property) {
var options = {