Skip to content

Instantly share code, notes, and snippets.

Cooking up great code

Nathan LeClaire nathanleclaire

Cooking up great code
View GitHub Profile
nathanleclaire / sudokuSolutionValidator.js
Last active Aug 29, 2015
This will take in a Sudoku possible solution as a string and validate it.
View sudokuSolutionValidator.js
var solutions = [
function isValidSolution(grid) {
if (typeof grid !== 'string' || grid.length !== 81) {
return false;
} else {
nathanleclaire / floodfill.go
Created Mar 6, 2014
Beginnings of a concurrent flood fill implementation in Go.
View floodfill.go
package main;
import (
type Canvas struct {
height int
nathanleclaire / docker-local.service
Last active Aug 29, 2015
Systemd script to initialize docker daemon in CoreOS Vagrant box for talking to from OSX.
View docker-local.service
Description=docker local
ExecStartPre=/usr/bin/systemctl kill docker.service
ExecStart=/usr/bin/docker -H -H unix:///var/run/docker.sock -d


This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2


View gist:5185e2d5a7987e487283
~$ docker run --rm -v /usr/local/bin/docker:/docker -v /var/run/docker.sock:/docker.sock svendowideit/samba volume_container
Unable to find image 'svendowideit/samba' locally
Pulling repository svendowideit/samba
f458f834a657: Download complete
511136ea3c5a: Download complete
574c4c3fda05: Download complete
d8309758b8fe: Download complete
7622a3fd4d7e: Download complete
948960c0d5bf: Download complete
28614c3b76a1: Download complete
View gist:022c24854b966983e447
Client version: 1.0.0
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 63fe64c
Server version: 1.0.0
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 63fe64c
View gist:816c604c2408127a4537
$ time vagrant
Usage: vagrant [options] <command> [<args>]
-v, --version Print the version and exit.
-h, --help Print this help.
Common commands:
box manages boxes: installation, removal, etc.
connect connect to a remotely shared Vagrant environment
destroy stops and deletes all traces of the vagrant machine
View gist:b219612bf99a17f8cde8
$ make binary
docker build -t "docker:master" .
Sending build context to Docker daemon 44.7 MB
Sending build context to Docker daemon
Step 0 : docker-version 0.6.1
# Skipping unknown instruction DOCKER-VERSION
Step 1 : FROM ubuntu:14.04
---> e54ca5efa2e9
Step 2 : MAINTAINER Tianon Gravi <> (@tianon)
---> Using cache
nathanleclaire / gist:0ea0672dee3b2458c2ad
Last active Aug 29, 2015
print all numbers < 1 million that have digits which sum to 42
View gist:0ea0672dee3b2458c2ad
print len([n for n in range(0, 1000000) if sum(int(i) for i in str(n)) == 42])
nathanleclaire /
Last active Aug 29, 2015
Kick up a couchbase cluster, print IP addresses for containers
docker run -d -p 11210:11210 -p 11211:11211 -p 8091:8091 -p 8092:8092 --name cb1 dustin/couchbase
for name in cb{2..5}; do
docker run -d --name $name dustin/couchbase
for name in cb{1..5}; do
docker inspect -f '{{ .NetworkSettings.IPAddress }}' $name