Skip to content

Instantly share code, notes, and snippets.


Jake jakekara

View GitHub Profile
jakekara / inbox_lambda.js
Created Nov 19, 2022
use lambda -> s3 as activitypub inbox
View inbox_lambda.js
import json
import boto3
from hashlib import md5
from datetime import datetime
// simple lambda to act as an activitypub inbox so you can receive
// follow requests, comments, etc from other servers.
// 1. set this up in a lambda and point API gateway at it.
// 2. set the api URL as your inbox in your actor JSON response
jakekara /
Last active Nov 19, 2022 - send activitypub payload to mastodon server
Deliver an ActivityPub message to an inbox
This is largely based on a ruby example `deliver.rb` from this blog post:
from datetime import datetime
jakekara /
Last active Jul 5, 2022
Generate delete commands for old versions of lambdas
# Generate a bunch of commands to delete all versions of
# lambdas with a given LAMBA_PREFIX
# this script generates `` which you can
# inspect first before running. this is super dangerous so
# you probably should not use this script.
for FUNCTION in $(aws lambda list-functions --region=us-east-1 \
conda create --name textgenrnn python
conda activate textgenrnn
conda install cudatoolkit==10.2.89
# this special conda source is vital to get the correct 8.1.x version of cudnn:
conda install -c conda-forge cudnn
git clone
cd textgenrnn
pip install -r requirements.txt
View .gitignore
jakekara / DebugLogger.ts
Created Oct 7, 2020
A quick wrapper for console.log .warn .error functions to improve devtools debugging
View DebugLogger.ts
* A cheap and cheerful logger that wraps console.log, .warn, .error, with
* labeling and silencing to make debugging with devtools easier.
export default class DebugLogger {
private _label: string;
private _silent: boolean;
constructor(label: string) {
this._label = label;
jakekara /
Created Sep 28, 2020
Authenticating with gapi in a react/typescript project

Authenticating with Google API in react/typescript project

This was surprisingly annoying to figure out.

I used this Google API documentation for vanilla JS, but it was a lot more trouble than I expected to get it working in a TypeScript React project.

Long story short, you need to install:

  • gapi-script
  • @types/gapi
jakekara / glob.wl
Last active Jul 11, 2020
Find files with matching patterns using wolframscript
View glob.wl
#!/usr/bin/env wolframscript
(* Recursively dump a list of files that match a given pattern *)
(* Very basic script to play with Wolfram outside of Notebooks *)
(* Jake Kara < *)
(* Example usage: *)
(* ./glob.wl "*.txt" *)
Length[$ScriptCommandLine] < 2,
jakekara /
Created Feb 20, 2020
Generate input files for aria2c download manager
Generate input files for aria2c.
For examples and documentation:
import re
class Aria2cInputEntry:
jakekara /
Created Sep 5, 2019
Simple approach to crop the margins of an image
import numpy as np
import cv2
# use the crop_image() function at the bottom. The rest are pretty much helpers.
# works well enough with William Blake illuminated books that I didn't have to
# try anything more sophisticated
def read_image(path):
return cv2.cvtColor(cv2.imread(path), cv2.COLOR_RGB2BGR)