Skip to content

Instantly share code, notes, and snippets.

View hjweide's full-sized avatar

Hendrik J. Weideman hjweide

View GitHub Profile
@hjweide
hjweide / parse_messages.py
Created February 5, 2017 02:30
Parse messages from a Facebook data archive.
def main():
inpath = 'messages.txt'
outpath = 'parsed.txt'
name = 'First Last'
marker = '%s:' % name
with open(inpath, 'r') as fin, open(outpath, 'w') as fout:
for line in fin.readlines():
if marker in line:
message = line.split(marker)[1].strip()
@hjweide
hjweide / benchmarks.py
Created August 1, 2020 02:29
Benchmarking 2D-A* algorithms
import imageio
import numpy as np
import pyastar
def maze_to_grid(img):
grid = img.astype(np.float32)
grid[grid == 0] = np.inf
grid[grid == 255] = 1