This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# This is written for OSX, python3, and the current (2018-12-04) version of the Notion app | |
# It writes incomplete todo items, found in Notion's localStorage, to a "todo.html" file, | |
# with links back to the Notion app | |
import os | |
import sqlite3 | |
import json | |
from html import escape |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
# Backup dropbox paper. | |
# This expects a ~/.auth/dropbox file that contains your dropbox bearer token. | |
import requests, os, json, re | |
from pprint import pprint | |
oj = os.path.join | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// Placed in the public domain | |
// list folders in primary Craft space | |
// I've combined this into one file for the gist | |
// The top reads the Craft DB into memory (takes about 380ms for 50k blocks) | |
// The end looks up and prints the folder names | |
// You can reuse the top bits for other purposes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// Placed in the public domain | |
// Dump craft database as json | |
// This is intended as a sample of how to extract craft raw data for | |
// playing around with. It has no dependencies aside from node. | |
// The top section reads the Craft DB into memory (takes about 380ms for 50k blocks) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# pip3 install pyobjc requests | |
from AppKit import NSPasteboard | |
import json, requests, re, sys | |
def rewrite(url): | |
m = re.match(r'https://www.craft.do/s/(\w+)',url) | |
if not m: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# This script creates Idris2.docset for use in Dash.app | |
# It expects idris to be in ~/.idris2 and is hardcoded to 0.5.1 at the moment. | |
import os, sqlite3, html5lib, re | |
oj = os.path.join | |
debug = lambda *x: None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://www.cs.nott.ac.uk/~psymp4/files/dependently-typed-compilers.pdf | |
data Exp : Type -> Type where | |
Val : t -> Exp t | |
Add : Exp Nat -> Exp Nat -> Exp Nat | |
If : Eq t => Exp Bool -> Exp t -> Exp t -> Exp t | |
eval : Exp t -> t | |
eval (Val x) = x | |
eval (Add x y) = eval x + eval y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ | |
\!! ‼ | |
\! ¡ | |
\!? ⁉ | |
\"' “ | |
\"< « | |
\"> » | |
\" ̈ | |
\"A Ä | |
\"E Ë |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script generates a treemap of the current memory usage (RSS) | |
awkcode=' | |
$1 == "PID" { next } | |
/.*/ { | |
cmd = substr($0,index($0,$4)); | |
sub(/.*\//,"",cmd); | |
gsub(/\//,"_",cmd); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module WellTyped | |
import Data.Vect | |
data Ty = TyInt | TyBool | TyFun Ty Ty | |
interpTy : Ty -> Type | |
interpTy TyInt = Integer | |
interpTy TyBool = Bool | |
interpTy (TyFun x y) = interpTy x -> interpTy y |