Skip to content

Instantly share code, notes, and snippets.

View JackMorganNZ's full-sized avatar

Jack Morgan JackMorganNZ

View GitHub Profile
@JackMorganNZ
JackMorganNZ / cs4hs-boxes.py
Last active December 4, 2017 09:32
CS4HS box image generator
import csv
from PIL import Image, ImageDraw
RAW_DATA = "data.csv"
GRID_SIZE = 6
BOX_SIZE = 10
IMAGE_SIZE = (GRID_SIZE * BOX_SIZE, GRID_SIZE * BOX_SIZE)
with open(RAW_DATA) as csvfile:
@JackMorganNZ
JackMorganNZ / create_math_equation_image.py
Created June 1, 2016 21:06
Example Python script for creating .png files for LaTeX math equations
import os, requests
def formula_as_file( formula, file):
formula = formula.replace('\n', ' ')
r = requests.get( 'http://latex.codecogs.com/png.latex?\dpi{{300}} {formula}'.format(formula=formula))
print('http://latex.codecogs.com/gif.latex?%5Cdpi%7B300%7D%20%5Cbegin%7Bbmatrix%7D%202%20%26%200%20%5C%5C%200%20%26%202%20%5C%5C%20%5Cend%7Bbmatrix%7D')
print(r.url)
f = open(file, 'wb')
f.write(r.content)
f.close()
@JackMorganNZ
JackMorganNZ / gist:d051a12e44ec4ce08639
Last active November 28, 2015 03:24
Instructions for CSFG Gource animation
git log --all --reverse --pretty=format:"%ct|%s" > log.txt
gource --title "Computer Science Field Guide Development" --dir-name-depth 2 --key --highlight-dirs --highlight-users --output-framerate 30 --caption-file log.txt --caption-duration 4 -f --viewport 1920x1080 --hide progress --hide mouse --stop-at-end --font-size 34 --caption-size 24
@JackMorganNZ
JackMorganNZ / chapter_folder_creator.py
Last active August 29, 2015 14:19
Python script for creating chapter folders and base files
import os
folders = ["algorithms",
"artificial_intelligence",
"complexity_tractability",
"coding_introduction",
"coding_compression",
"coding_encryption",
"coding_error_control",
"computer_graphics",