I came across an article from https://til.simonwillison.net/ and learned about datasette. It's a pretty cool template to write and publish TILs.
TLDR; this is the commit for a base setup that works.
List of features I like:
Thanks to simonw on the well written and easy-to-understand .github/workflows/build.yml
. I disabled some features for basic template to work:
git diff HEAD~10
didn't work for new repo.Added environment variables in github actions' secrets:
NOW_TOKEN
OPENAI_API_KEY
Adjusted Actions permissions > Workflow permissions to enable read and write permission
.
This is simple, just create a new project in vercel, disable the github integration and change the deploy script --project
values.
Update on 15 Aug 2024 - Currently vercel supports python 3.9 deployment only on node.js 18.x (legacy build), not the default 20.x. The version can be changed in vercel settings.
Also, add a domain til.alvinsj.net
in both vercel and cloudflare dns, e.g., cname til cname.vercel-dns.com
.
I downloaded the db but it needed some cleanup.
# Clean up records
DELETE from similarities;
DELETE from embeddings;
DELETE from til;
# This will drop all til_fts_* tables as well
DROP TABLE til_fts;
# Recreate fts
CREATE VIRTUAL TABLE til_fts USING fts5(title, body);
INSERT INTO til_fts(title, body) SELECT title, body FROM til;
It's useful to test the build_database.py
script locally.
$ conda create --name=alvinsj-til
$ conda activate alvinsj-til
$ conda install pip
$ pip install -r requirements.txt
$ python build_database.py
Created 2023-12-08T19:53:59+08:00, updated 2024-08-15T18:11:50+02:00 · History · Edit