Skip to content

Instantly share code, notes, and snippets.

View goakley's full-sized avatar

Glen Oakley goakley

View GitHub Profile
@goakley
goakley / main.py
Last active March 22, 2022 17:27
zytemp script for use with streetturtle/noobie
import json
import pyzytemp
def main():
t = None
co = None
x = pyzytemp.find()
if x:
temp = x[0]
attempts = 8
input :: [String]
input = [
"billowy",
"biopsy",
"chinos",
"defaced",
"chintz",
"sponged",
"bijoux",
"abhors",
type Point = (Double,Double)
type Triangle = (Point,Point,Point)
type Sierpinski = [Triangle]
midpoint :: Point -> Point -> Point
-- ^point between two points
midpoint (x1,y1) (x2,y2) = ((x1 + x2) / 2, (y1 + y2) / 2)
vec :: Point -> Point -> Point
-- ^two points into a vector
#!/bin/bash
editors="ed ex vi emacs"
echo $editors | sed s/\ /\\n/g | shuf | head -1
@goakley
goakley / tilted.py
Created March 24, 2014 03:01
Tilts the screen based on the orientation of my laptop
#!/usr/bin/python3
from collections import deque
from time import sleep
from os import system
def tilt():
with open('/sys/devices/platform/lis3lv02d/position') as f:
return int(f.read().split(",")[1])
@goakley
goakley / collage.py
Created February 15, 2014 18:12
Generates a collage given a directory containing only images
#!/usr/bin/env python3
import glob
from PIL import Image
from random import shuffle
from sys import argv
# The maximum size an individual image can be
MAXSIZE = (640,480)
@goakley
goakley / trigram.py
Created November 11, 2013 01:17
Trigram tool that takes text input and creates a random output based on the N-grams of the input.
#!/usr/bin/env python
"""
Trigram tool that takes text input and creates a random output based
on the N-grams of the input.
"""
import argparse
from sys import stdin
from random import choice
#!/bin/bash
# subtree merge with branches
rm -rf commcare-hq core-hq
git clone git://github.com/dimagi/commcare-hq.git
git clone git://github.com/dimagi/core-hq.git
cd core-hq
@goakley
goakley / NCR.java
Created April 27, 2013 20:50
Java-based nCr on an array for @AlexaCain and @lhsu92 - Gets all `r` combinations on an array of ints
class NCR {
// Take the factorial of an integer
public static int factorial(int num)
{
int fact = 1;
for (int i = 1; i <= num; i++)
fact = fact*i;
return fact;
}
@goakley
goakley / captainm.c
Created April 1, 2013 00:54
Captain's Mistress game written in C, with an AI that utilizes Alpha-Beta depth-limited pruning.
#include <limits.h>
#include <stdio.h>
#define DEPTH (7)
long int max(long int a,long int b){return(a>b?a:b);}
long int min(long int a,long int b){return(a<b?a:b);}
short player();
short ai();