Skip to content

Instantly share code, notes, and snippets.

View spro's full-sized avatar
🤙
!

Sean Robertson spro

🤙
!
View GitHub Profile
@spro
spro / gist:84f62bcd66207aa1e136
Last active August 29, 2015 14:05
Consul panic
2014/08/21 08:52:13 [INFO] consul.fsm: snapshot created in 23.435us
2014/08/21 08:52:13 [INFO] raft: Starting snapshot up to 8232
2014/08/21 08:52:13 [INFO] snapshot: Creating new snapshot at /tmp/consul/raft/snapshots/2-8232-2014-08-21T08:52:13.72566997-07:00.tmp
2014/08/21 08:52:13 [INFO] raft: Compacting logs from 1 to 8232
panic: runtime error: index out of range
goroutine 30 [running]:
runtime.panic(0x9bdc40, 0xf763fc)
/opt/go/src/pkg/runtime/panic.c:279 +0xf5
encoding/binary.bigEndian.Uint64(0xf8f230, 0x0, 0x0, 0xc208201300)
@spro
spro / counters.coffee
Created September 23, 2014 00:16
React.js test with flux-ish data/action layer and undoable states
D = React.DOM
Button = ({text, action}) ->
D.button(onClick: action, text)
# Views
# ------------------------------------------------------------------------------
# <App>
# - <Counter Collection>
@spro
spro / bookshelf-basic.coffee
Last active August 29, 2015 14:12
Bookshelf.js Examples
knex = require('knex')(client: 'pg', connection: 'postgres:///test1')
bookshelf = require('bookshelf')(knex)
util = require 'util'
inspect = (o) -> console.log util.inspect o.toJSON(), colors: true
# Schema
# ------
User = bookshelf.Model.extend
@spro
spro / hipache.nginx.conf
Last active August 29, 2015 14:13
hipache reimplimented in lua in nginx
location / {
set $proxy_to "";
access_by_lua "
local redis = require 'redis'
local red = redis:new()
red:connect('127.0.0.1', 6379)
local headers = ngx.req.get_headers()
local hosts = red:smembers('frontend:' .. headers['host'])
Verifying that +spro is my openname (Bitcoin username). https://onename.com/spro
@spro
spro / gist:7c929c5213253e054a04
Created June 17, 2015 07:39
Overly simple REST API with Bottle.py
import bottle
import json
all_people = [
{'name': 'Fred Wilson'},
{'name': 'Fred Durst'},
{'name': 'Fred Astaire'},
]
@bottle.get('/people.json')
@spro
spro / generated-20160128162937.coffee
Last active January 29, 2016 00:36
char-rnn generated CoffeeScript; -rnn_size 100 -max_epochs 50 -temperature 0.7
somata = new somata.Client
if errors.length
res.send 401
# User account
# ---------------------------------------------------------------------------------------
app.get '/streets/:channel_id/channels.json', (req, res) ->
email_form =
@spro
spro / dnsmasq OS X.md
Last active March 16, 2016 09:45 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

> please if the temperature in minnesota is equal to 2 then turn the office light off thanks
( %if
( %condition
( %currentWeather
( $location minnesota ) )
( $operator equal to )
( $number 2 ) )
( %setDeviceState
( $device.name office light )
@spro
spro / pytorch-simple-rnn.py
Last active November 7, 2024 11:24
PyTorch RNN training example
import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.autograd import Variable
from torch import optim
import numpy as np
import math, random
# Generating a noisy multi-sin wave