Skip to content

Instantly share code, notes, and snippets.

View mathuin's full-sized avatar

Jack Twilley mathuin

View GitHub Profile
@mathuin
mathuin / proxyjson_server.py
Last active August 29, 2015 13:57
Trying to run this test against this code. I get an error about the reactor being unclean. What does that mean in this context?
from twisted.internet.endpoints import TCP4ServerEndpoint
from twisted.internet.error import CannotListenError
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor
import simplejson as json
# Ports available for proxy purposes.
low_port = 5000
high_port = 5100
@mathuin
mathuin / small_server.py
Last active August 29, 2015 13:57
Problem with StringTransport() and StringTransportWithDisconnection() not handling loseConnection as expected
from twisted.internet.protocol import Factory, Protocol
class SmallFactory(Factory):
def buildProtocol(self, addr):
return Small(self)
class Small(Protocol):
def __init__(self, factory):
@mathuin
mathuin / computeproximity.go
Created August 12, 2014 15:53
This is a standalone example demonstrating the "Failure Error" I am getting when attempting to use the ComputeProximity algorithm from GDAL.
package main
import (
"fmt"
"log"
"github.com/lukeroth/gdal"
)
func main() {
@mathuin
mathuin / persistent.sfs
Created July 5, 2015 04:06
persistent.sfs with SCANsat content
GAME
{
version = 1.0.4
Title = Mathuin (CAREER)
Description = No description available.
linkURL =
linkCaption =
Mode = CAREER
Status = 1
scene = 5
'name': 'TIS-100 Assembly'
'scopeName': 'source.TIS'
'patterns': [
{
'match': '[#].*$'
'name': 'comment.line'
}
{
'match': '\\b(?i:nop|mov|swp|sav|add|sub|neg|jmp|jez|jnz|jgz|jlz|jro)\\b'
'name': 'keyword.mnemonic'
@0
## GOOD SOLUTION
MOV UP, DOWN
@1
MOV RIGHT, DOWN
@2
MOV UP, LEFT
@mathuin
mathuin / mwe-thesis.tex
Last active October 5, 2016 00:40
Updated version: code now works, added some whitespace to make some things more obvious.
\documentclass{minimal}
\usepackage{filecontents}
\begin{filecontents}{thesis.tex}
\documentclass{book}
\input{preamble}
\begin{document}
\chapter{Lit Review}
\input{litreview}%
@mathuin
mathuin / kittenscript
Created June 21, 2015 23:25
Kittens Game Current Scripts
starClick = setInterval(function() { $("#gameLog").find("input").click(); }, 2 * 1000);
autoCatnip = setInterval(function() {
var catnip = gamePage.resPool.get('catnip');
var calendar = gamePage.calendar;
// Only run if positive catnip and not in last half of Autumn
if (catnip.perTickUI < 0) { return; }
if (catnip.value / catnip.maxValue < 0.95) { return; }
if (calendar.season == 2 && calendar.day > 50) { return; }
#!/usr/bin/env sh
docker-machine rm -f rancher host1
docker-machine create rancher --driver virtualbox --virtualbox-cpu-count "-1" --virtualbox-disk-size "8000" --virtualbox-memory "512" --virtualbox-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v1.11.2/boot2docker.iso
docker-machine scp scripts/rancher-net.sh rancher:.
docker-machine ssh rancher sh rancher-net.sh
docker-machine regenerate-certs rancher -f
eval $(docker-machine env rancher)
docker-compose up -d
eval $(docker-machine env -u)
docker-machine create host1 --driver virtualbox --virtualbox-cpu-count "-1" --virtualbox-disk-size "54000" --virtualbox-memory "2048" --virtualbox-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v1.11.2/boot2docker.iso
@mathuin
mathuin / typescript
Created August 2, 2019 01:57
TF_LOG=1 terraform apply -auto-approve -no-color (second run!)
2019/08/01 18:56:34 [WARN] Invalid log level: "1". Defaulting to level: TRACE. Valid levels are: [TRACE DEBUG INFO WARN ERROR]
2019/08/01 18:56:34 [INFO] Terraform version: 0.12.6
2019/08/01 18:56:34 [INFO] Go runtime version: go1.12.4
2019/08/01 18:56:34 [INFO] CLI args: []string{"/home/jmt/bin/terraform_0.12.6", "apply", "-auto-approve", "-no-color"}
2019/08/01 18:56:34 [DEBUG] Attempting to open CLI config file: /home/jmt/.terraformrc
2019/08/01 18:56:34 Loading CLI configuration from /home/jmt/.terraformrc
2019/08/01 18:56:34 [INFO] CLI command args: []string{"apply", "-auto-approve", "-no-color"}
2019/08/01 18:56:34 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/08/01 18:56:34 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/08/01 18:56:34 [DEBUG] New state was assigned lineage "986ad60b-5a48-7ce2-3989-b0dda8a061c1"