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
JonnoFTW / renderer.py
Created August 16, 2017 04:33
shapefile renderer for pyramid
writer = shapefile.Writer(shapeType=shapefile.POINT)
writer.autoBalance = 1
# iterate through the entire dataset and extract the field names
headers = {}
for row in data:
headers.update({k.replace('PID_', '').split(' ')[0]: type(v) for k, v in row.items() if v is not None})
del headers['pos']
writer.field('latitude', 'N', '32', 15)
writer.field('longitude', 'N', '32', 15)
header_map = {
@JonnoFTW
JonnoFTW / main.py
Last active August 15, 2017 07:11
Simple flask-socket and WebSocket interaction
from flask import Flask
from flask_sockets import Sockets
import json
from random import randint
app = Flask(__name__)
sockets = Sockets(app)
current_players = {}
game_x_min = 0
ser = serial.Serial(path, baudrate=38400, timeout=1)
ser_io = io.TextIOWrapper(io.BufferedRandom(ser),
newline='\r',
line_buffering=False,
encoding='ascii')
#!/usr/bin/python2
#####################################NOTICE######################################
### This program is free software: you can redistribute it and/or modify ###
### it under the terms of the GNU General Public License as published by ###
### the Free Software Foundation, either version 3 of the License, or ###
### (at your option) any later version. ###
### This program is distributed in the hope that it will be useful, ###
### ###
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
@JonnoFTW
JonnoFTW / en_au.js
Created April 10, 2017 12:45
english words minus the swears
This file has been truncated, but you can view the full file.
var Dictionary = new Set([
"a",
"aah",
"aardvark",
"aardvarks",
"ab",
"aback",
"abacus",
"abacuses",
"abaft",
@JonnoFTW
JonnoFTW / boggle_solver.js
Last active December 27, 2019 16:01
Javascript boggle solver
/**
* Created by mack0242 on 6/04/17.
*/
var TrieNode = function (parent, value) {
this.parent = parent;
this.children = new Array(26);
this.isWord = false;
if (parent !== undefined) {
parent.children[value.charCodeAt(0) - 97] = this;
}
/**
* Created by mack0242 on 5/04/17.
*/
var Node = function(value, row, col) {
this.value = value
this.row = row
this.col = col
}
var Path = function() {
@JonnoFTW
JonnoFTW / en_au_dict.js
Last active January 21, 2021 19:18
Australian English Dictionary javascript dictionary with no proper nouns
var Dictionary = new Set([
"a",
"aah",
"aardvark",
"aardvarks",
"ab",
"aback",
"abacus",
"abacuses",
"abaft",
<pyopencl.Device 'Tonga' on 'AMD Accelerated Parallel Processing' at 0x749460>
Repeating [test_overwrite_ecb()] 1000 times....
Function [test_overwrite_ecb] finished in average of 0:00:00.003962
Repeating [test_overwrite_efb()] 1000 times....
Function [test_overwrite_efb] finished in average of 0:00:00.002380
from PIL import Image
import numpy as np
import pyprind
import random
import os
import pygame
from collections import defaultdict, Counter
class MarkovChain(object):