Skip to content

Instantly share code, notes, and snippets.

Leland Batey lelandbatey

Block or report user

Report or block lelandbatey

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
lelandbatey /
Created Oct 15, 2019
Read and process MTGA log events
import json
def arena_card_db():
carddb = dict()
with open("AllCards.json", 'r') as mtgjsonf:
carddb = json.load(mtgjsonf)
arena_cards = list()
for card_name, card in carddb.items():
lelandbatey / sane_text_formatter.go
Created Oct 1, 2019
Sane text formatter. Formats text in a 'nice' way, though very basic.
View sane_text_formatter.go
package main
import (
lelandbatey / json_schema_stats
Last active Jul 12, 2019
A tool for examining statistics about JSON object structures. A great way to examine documents in a MongoDB collection for consistency.
View json_schema_stats
#! /usr/bin/env python3
# Downloaded from here:
from collections import Sequence
from operator import itemgetter
from codecs import escape_encode
import argparse
import json
import math
import sys
lelandbatey /
Created May 23, 2019
Turn an indented block of text into a 'tree' view with unicode lines
#!/usr/bin/env python3
Treeify takes a file (on stdin or passed as the first argument) and converts
it's indentation into a 'tree' representation. As an example:
lelandbatey / assign_struct_field_by_tag_name.go
Last active Apr 29, 2019
Golang reflection; assign to struct field by tag name
View assign_struct_field_by_tag_name.go
package main
import (
// The goal: allow assignment to a go struct field based on the name that field
// is tagged with (specifically it's json-tagged name).
lelandbatey /
Created Mar 16, 2019
A recipe for spanish-style rice with tomato, rice, and beans
lelandbatey / index.html
Created Mar 11, 2019
A demonstration of the importance of correct RGB color interpolation
View index.html
<!DOCTYPE html>
<html lang="en">
<script src=""></script>
<script src=""></script>
<body style="margin: 0;">
<canvas id='canvas1' width='800' height='200'></canvas>
lelandbatey /
Created Nov 4, 2018
A recipe for stir fry peppers and onions. Taken from the New York Times, but now more accessible and not behind a paywall.
lelandbatey /
Last active Feb 9, 2017
Proto-minesweeper probability -- a kludged together POC for statistics of mines in squares
A toy example to calculate the probability of a mine existing on any particular square.
Runs slowly and is organized like spaghetti, but it does currently work!
Note that for this to work, it depends on a slightly modified defusedivision;
inside defuse_division the _create_foothold function in has to be
modified to be public, instead of private like in the public version.
lelandbatey / distribution.js
Last active Dec 18, 2016
Poisson disk, implemented from the paper!
View distribution.js
// I implemented poisson disk selection from this paper:
// This was very fun, I highly recommend it to anybody!
function create_draw(ctx) {
return {
line: (start, end) => {
let [sx, sy] = start;
let [ex, ey] = end;
You can’t perform that action at this time.