Skip to content

Instantly share code, notes, and snippets.


Nick Gauthier ngauthier

View GitHub Profile
ngauthier / timeout_and_tick.go
Created Feb 10, 2015
Golang timeout and tick loop
View timeout_and_tick.go
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout:
ngauthier /
Created Jul 5, 2012
Rdio "native" in linux

I like Rdio and linux. Rdio works great in a browser except for one thing: keyboard shortcuts!!!

When coding, I like to be able to play/pause my music quickly, meaning I don't want to switch windows. I figured out a way to do this:

Google Chrome --app

First, I made a file in my ~/bin called rdio that runs:

google-chrome --app=
View field_sampler.go
package fieldsampler
import (
const (
// CustomSampleRateFieldName is the field to use to override the default Sample Rate
CustomSampleRateFieldName = "CustomSampleRate"
#!/usr/bin/env bash
set -e
USAGE="Usage: migrate <up|down|new|init>"
export PGDATABASE=${PGDATABASE:-meetspace}
cd `dirname $0`/../migrations
View errors.js
(function() {
window.onerror = function(message, url, line, column) {
if (typeof url === "undefined" || url === null || url === "") {
var data = JSON.stringify({
message: message,
url: url,
line: line,

Honeycomb Beeline Golang - Field Sampler


// Configure it with a default sample rate
hook, err := fieldsampler.NewFieldSamplerHook(1)
if err != nil {
ngauthier /
Last active Sep 5, 2018
install ruby 2.0.0-p0 on ubuntu
ngauthier /
Created Jan 29, 2015
Clean up docker containers and images
# Docker
function docker-cleanup {
# Find all containers that have exited
containers=`docker ps -a -q -f status=exited | xargs`
if [[ $containers ]]; then
# Remove exited containers
docker rm $containers
echo "No containers to remove"

Keybase proof

I hereby claim:

  • I am ngauthier on github.
  • I am ngauthier ( on keybase.
  • I have a public key ASDxB3I8Mq8d2GMauNlQdEGZKiu29cVrnz_zK6gLX-XU_go

To claim this, I am signing this object:

ngauthier / scraping.rb
Last active Mar 1, 2017
Scraping the Web with Ruby Code
View scraping.rb
#!/usr/bin/env ruby
# From:
require 'capybara'
require 'capybara/poltergeist'
require 'csv'
require 'gdbm'
class NickBot
include Capybara::DSL