Skip to content

Instantly share code, notes, and snippets.


Jacob O'Bryant jacobobryant

View GitHub Profile
jacobobryant / dashboard.clj
Last active March 28, 2023 06:08
Internal dashboard code being used in
View dashboard.clj
(:require [com.biffweb :as biff]
[clojure.string :as str]
[cheshire.core :as cheshire]))
(defn debug [x]
[:pre (with-out-str (biff/pprint x))])
;; slight modification of clojure.core/distinct
(defn distinct-by
jacobobryant / s3.clj
Created March 4, 2023 05:29
Helper fn for S3
View s3.clj
;; Example usage:
;; Upload object:
;; (s3/request sys
;; {:bucket "your-bucket"
;; :method "PUT"
;; :key "some-key"
;; :body "some-body"
;; :headers {"x-amz-acl" "private" ;; change to "public-read" if you want a publicly accessible URL
jacobobryant / juice.js
Last active February 25, 2023 02:08
Some JS functions used in Yakread
View juice.js
// A serverless function for Readability that I'm currently using
let juice = require('juice');
function main(opts) {
let html = juice(opts['html'], { webResources: { images: false } });
return { body: { html } };
exports.main = main;
jacobobryant /
Created August 20, 2021 18:25
Example of debugging an http endpoint (or function in general) in Biff (or Clojure in general)
jacobobryant / Dockerfile
Created December 18, 2022 01:30
Dockerfile for deploying Biff on
View Dockerfile
from clojure:temurin-17-tools-deps-bullseye
ENV BB_COMMIT=965c177bca31ae9882c975ef7db448e12f59984e
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN curl$TRENCH_VERSION/trenchman_${TRENCH_VERSION}_linux_amd64.tar.gz \
jacobobryant /
Created September 16, 2022 17:30
Newsletter topic extraction
Usage: python extract_keywords
Reads from storage/keywords/corpus.csv, which has columns `<ID>,<Title>,<Description>`. Writes
keywords to storage/keywords/output.csv
I use this for newsletter topic modeling at
import sys
import nltk
jacobobryant / bookmarklet.js
Last active May 19, 2022 20:14
How to make your own airtable bookmark bookmarklet
View bookmarklet.js
// 1. Create a table on Airtable, and make URL/text columns with these names:
// URL, Title, Description, Image, Feed
// 2. Add a Form view. Click "Open form", then copy the URL. Set `airtable_form_url`
// below to that URL.
// 3. Create a new bookmark in your web browser, and paste in the code below. Whenever
// you're on a page you want to save, click the bookmark ("bookmarklet", technically).
// You'll go to the airtable form, and the columns listed above will be prefilled.
jacobobryant /
Last active March 25, 2022 16:06
refreshing namespaces breaks *data-readers*

If you call before requiring any namespaces referenced in data_readers.clj, then *data-readers* gets messed up somehow. The readers you define in data_readers.clj won't work even if you require their namespaces. For example:

$ find -type f
jacobobryant /
Created February 4, 2022 01:26
git dad: improve git's error message

Add this to your .bashrc to improve git's error message for a common typo:

git() {
  if [ "$1" = dad ]; then
    curl -H "Accept: text/plain"
    $(which git) "$@"

Ratings API

I just added an API endpoint which gives you all your ratings as JSON. You could use it to e.g. fetch all your favorited articles and send them to your aunt. You can enable it from the settings page.

Also, Findka Essays has been a little flaky this week. There have been a couple days when it hasn't sent the emails out. I can trigger them manually, but I, uh, sometimes get distracted. Anyway, I've tweaked some things and hopefully it won't be an issue anymore. But either way, I'm keeping an eye on it, and I'll dig in further if the problem persists.