Skip to content

Instantly share code, notes, and snippets.

View willismonroe's full-sized avatar

M. Willis Monroe willismonroe

View GitHub Profile
@willismonroe
willismonroe / markov.py
Created May 9, 2017 17:11
Simple Markov Chain in Python
import random
def markov(string, length):
list_of_tokens = string.split()
markov_dict = {}
prev = None
for token in list_of_tokens:
if prev is not None:
if prev in markov_dict.keys():
markov_dict[prev].append(token)
@willismonroe
willismonroe / saao08 zipping.dart
Created January 17, 2018 19:38
Reading zip archive, extracting one file, decoding JSON and printing list of keys.
import 'dart:io';
import 'dart:convert';
import 'package:archive/archive.dart';
void main() {
List<int> bytes = new File('saao-saa08.zip').readAsBytesSync();
Archive archive = new ZipDecoder().decodeBytes(bytes);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@willismonroe
willismonroe / M388 suffixes and prefixes.ipynb
Created January 22, 2019 20:19
M388 suffixes and prefixes.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@willismonroe
willismonroe / lib.typ
Last active January 9, 2024 16:02
Local bibliography for Typst
/* This typst local package will allow you to reference the same bibliography file from any typst file
Steps:
1) Create the directory ~/.local/share/typst/packages/local/mybib/1.0.0
2) Write a typst.toml file containing:
[package]
name = "mybib"
version = "1.0.0"
entrypoint = "lib.typ"
authors = ["Your Name Here"]