Skip to content

Instantly share code, notes, and snippets.

View eliask's full-sized avatar
🥼

Elias Kunnas eliask

🥼
View GitHub Profile
@eliask
eliask / factorio-recipe-parser.lua
Last active September 10, 2021 15:41 — forked from pfmoore/factorio-recipe-parser.lua
Parse the Factorio recipe files to create a CSV of recipes
--[[ Usage
Windows:
lua factorio-recipe-parser.lua "C:/Apps/Factorio/data/base/prototypes/recipe/"
Steam on macOS:
lua factorio-recipe-parser.lua ~/"Library/Application Support/Steam/steamapps/common/Factorio/factorio.app/Contents/"
NB: json.lua is from https://gist.github.com/tylerneylon/59f4bcf316be525b30ab
]]--
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
# Usage: double_utf8_fix.py < input > output
import sys, re
# functions to detect/fix double-encoded UTF-8 strings
# Based on http://blogs.perl.org/users/chansen/2010/10/coping-with-double-encoded-utf-8.html
DOUBLE_ENCODED = re.compile("""
\xC3 (?: [\x82-\x9F] \xC2 [\x80-\xBF] # U+0080 - U+07FF
| \xA0 \xC2 [\xA0-\xBF] \xC2 [\x80-\xBF] # U+0800 - U+0FFF
@eliask
eliask / hinton.py
Created February 16, 2012 22:10 — forked from dwf/hinton.py
A function for drawing Hinton diagrams with matplotlib.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# https://gist.github.com/292018 - augmented to plot row/column labels
"""
Draws Hinton diagrams using matplotlib ( http://matplotlib.sf.net/ ).
Hinton diagrams are a handy way of visualizing weight matrices, using
colour to denote sign and area to denote magnitude.
By David Warde-Farley -- user AT cs dot toronto dot edu (user = dwf)
with thanks to Geoffrey Hinton for providing the MATLAB code off of