Skip to content

Instantly share code, notes, and snippets.

View spro's full-sized avatar
🤙
!

Sean Robertson spro

🤙
!
View GitHub Profile
#!/bin/bash
HOSTNAME=$1
# Set up environment
git clone http://github.com/spro/dotfiles
cd dotfiles && ./bin/install-dotfiles
cd ~
sudo hostname $HOSTNAME
source ~/.bash_profile
@spro
spro / espancanese.lua
Created May 24, 2017 00:16
Small synthetic language for testing seq2seq model
-- > te grillo wa silencieusement matte iru
-- = your cricket is sleeping silently
genders = {
m={
the='el',
a='un',
my='me',
your='te',
},
@spro
spro / pytorch-simple-rnn.py
Last active April 25, 2022 10:50
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
> 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 / 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

@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 / 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')
Verifying that +spro is my openname (Bitcoin username). https://onename.com/spro
@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'])
@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