Skip to content

Instantly share code, notes, and snippets.

Jason Sperske jasonsperske

Block or report user

Report or block jasonsperske

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jasonsperske /
Last active May 26, 2019
Like my but for Duke Nukem 3D MAP files
#!/usr/bin/env python3
import struct
import re
import io
from collections import namedtuple
GrpFileDefinition = namedtuple('GrpFileDefinition', 'name size')
Line = namedtuple('Line', 'a b is_one_sided')
jasonsperske /
Last active Dec 23, 2018
An Amazon Technical interview question I received this year. Write a function that when given a map (a 2-dimensional grid where 1 is a walk-able square, 0 is an impassable square and 9 is the destination) and starting at the top left (x:0, y:0) finds the shortest path to the destination
import java.util.Arrays;
public class Examples {
public static void main(String ... args) {
Solution s = new Solution();
System.out.print("Example problem: ");
System.out.println(s.shortest(3, 3,
Arrays.asList(1, 0, 0),
jasonsperske / MIT-LICENSE
Last active Dec 20, 2018
A simple Python program that can read DOOM.Hexen IWAD and PWAD files and render them as SVG see examples at
MIT License
Copyright (c) 2018 Jason Sperske
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
jasonsperske / FencePainter.js
Last active Feb 3, 2018
Another Google technical interview question that left me stumped. "Write an algorithm that counts the number of ways you can paint a fence with N posts using K colors such that no more than 2 adjacent fence posts are painted with the same color". Here is a recursive approach:
View FencePainter.js
var paint = function (posts, colors, display) {
var painter = function (posts, colors, fence, count, display) {
var color, total = count;
if (posts === 0) {
//Would you like to see them? Pass a display function
if(display) {
return 1;
} else {
View hue.js
//An example of this can be seen at
function HueSegments(steps) {
var segments = []
var step
var increment = 200/steps
for(step = 0; step < steps; step++) {
segments.push("hsla("+(Math.floor(increment*step))+", 100%, "+(step % 2 == 0 ? "75" : "50")+"%, 1)")
return segments
jasonsperske / deepSet.js
Created Nov 1, 2017
Setting a deep JSON property with one call, a answer to a question on StackOverflow that was deleted before I could post it
View deepSet.js
function deepSet(keys, defaultValue) {
var keyNames = keys.split('.')
var out = defaultValue
var temp
var size = keyNames.length
var i
for (i = size - 1; i >= 0; i--) {
temp = out
out = {}
jasonsperske /
Created Sep 28, 2017 Posted at 22:28 Oct 09, 2006 by Andreas Sterbenz
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.

Keybase proof

I hereby claim:

  • I am jasonsperske on github.
  • I am sperske ( on keybase.
  • I have a public key ASDulU5JtSD8n6FbUOUc-Ew2aEepk77hUZO8-pUPKWGyJAo

To claim this, I am signing this object:

jasonsperske / deepestNode.js
Last active Jul 12, 2017
Find the deepest left most node in a binary tree (and it's depth). A working demo can be found at:
View deepestNode.js
var Node = function(name, left, right) { = name;
this.left = left;
this.right = right;
findDeepest = function(node, depth) {
var left, right, depth = depth || 0;
if(typeof node !== 'undefined') {
left = findDeepest(node.left, depth+1);
right = findDeepest(node.right, depth+1);
jasonsperske / index.html
Created Jun 21, 2017
Get Location Information
View index.html
<!DOCTYPE html>
<meta http-equiv=content-type content="text/html;charset=UTF-8">
<title>GeoLocation Diagnostics</title>
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1">
<meta name=format-detection content="telephone=no">
<link href="" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
You can’t perform that action at this time.