Skip to content

Instantly share code, notes, and snippets.

View JonnoFTW's full-sized avatar
Fighting off bugs with a sword 🤺

Jonathan Mackenzie JonnoFTW

Fighting off bugs with a sword 🤺
View GitHub Profile
JonnoFTW / gist:7694727
Created November 28, 2013 16:40
Python sudoku solver.
import heapq
import itertools
nums = set(range(1,10))
class Node:
def __init__(self, grid):
self.children = []
self.grid = grid
self.answered = 0
for i in self.grid:
public class CameraSurface extends SurfaceView implements Callback {
private Camera mCamera;
private SurfaceHolder mHolder;
private Context c;
private static final String CNAME = ScanActivity.class.getName();
private PreviewCallback cb;
public CameraPreview(Context context, PreviewCallback cb) {
this.c = context;
// Quadtree.js usage looks like:
var markers = []; // some array of google map markers
quadTree = new QuadTree(markers);
console.log("Built quadtree with size "+markers.length);
var bounds = map.getBounds();
console.log("New Bounds"+bounds.toString());
// find all points within the viewport bounding rectangle,
// or whatever rectangle you supply
var foundPoints = quadTree.queryRectangle(bounds);
from collections import Counter
import re, praw
print "Fetching unimportant words..."
import nltk'stopwords')
from nltk.corpus import stopwords
c = Counter()
r = praw.Reddit(user_agent='praw')
username = 'username'
print "Logging in as",username
JonnoFTW / LaTeX template
Created November 24, 2014 11:16
Basic template I use for LaTeX documents
public class BST<T extends Comparable<? super T>> {
private Node root;
private int size = 0;
public void insert(T value) {
root = insert(value,root);
JonnoFTW / -
Created December 8, 2015 05:10
2015-12-08T11:14:06.872092+00:00 heroku[router]: at=info method=GET path="/create/kw_energy_consumption" request_id=5851ad11-5abd-4d10-aab0-5524f5ab8d08 fwd="" dyno=web.1 connect=1ms service=156ms status=500 bytes=269
2015-12-08T11:14:06.863757+00:00 app[web.1]: while parsing configuration file: None.
2015-12-08T11:14:06.863762+00:00 app[web.1]: Traceback (most recent call last):
2015-12-08T11:14:06.863764+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/nupic/support/", line 338, in _readConfigFile
2015-12-08T11:14:06.863764+00:00 app[web.1]: " variable %r, which is not defined" % (varname))
2015-12-08T11:14:06.863765+00:00 app[web.1]: RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
2015-12-08T11:14:06.867657+00:00 app[web.1]: ERR: Unable to create region Classifier of type CLAClassifierRegion [/home/t
C:\Users\Jonathan\Documents\GitHub\htm-over-http\test [master +1 ~0 -0 !]> python .\
Feed the data from rec-center-hourly.csv into the
htm REST API and compare the results with the
standard results provided in the tutorial
Made model 25b22f16-196a-4fcf-af5a-1c5d9939df03
{'timestamp': 1277994600, 'kw_energy_consumption': '21.2'}
{u'likelihood': 0.5, u'anomaly_score': 1.0, u'prediction': 21.2}
{'timestamp': 1277998200, 'kw_energy_consumption': '16.4'}
JonnoFTW / airodump-mod.c
Created December 17, 2015 00:55
Deleting items in airodump
void enqueue_stations() {
struct ST_info *st_cur;
struct ST_info *st_next;
st_cur = G.st_1st;
st_next = NULL;
while(st_cur != NULL)
st_next = st_cur->next;
// if we haven't seen the device in the last 10 seconds