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
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) {
super(context);
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
nltk.download('stopwords')
from nltk.corpus import stopwords
c = Counter()
r = praw.Reddit(user_agent='praw')
username = 'username'
print "Logging in as",username
@JonnoFTW
JonnoFTW / LaTeX template
Created November 24, 2014 11:16
Basic template I use for LaTeX documents
\documentclass[11pt]{article}
\usepackage[english]{babel}
\usepackage{a4wide}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{url}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[T1]{fontenc}
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
JonnoFTW / -
Created December 8, 2015 05:10
10.30.0.177
2015-12-08T11:14:06.872092+00:00 heroku[router]: at=info method=GET path="/create/kw_energy_consumption" host=morning-meadow-1412.herokuapp.com request_id=5851ad11-5abd-4d10-aab0-5524f5ab8d08 fwd="121.45.152.138" dyno=web.1 connect=1ms service=156ms status=500 bytes=269
2015-12-08T11:14:06.863757+00:00 app[web.1]: ERROR:com.numenta.nupic.tools.configuration_base:Error 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/configuration_base.py", 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 .\hotgym.py
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
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
@JonnoFTW
JonnoFTW / -
Created December 17, 2015 04:52
10.30.0.159