Skip to content

Instantly share code, notes, and snippets.

```
$ git push server main
+ export DOKKU_HOST_ROOT=/home/dokku
+ DOKKU_HOST_ROOT=/home/dokku
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOCKER_BIN=docker
+ DOCKER_BIN=docker
@tianhuil
tianhuil / dnsovertls.md
Created September 20, 2021 13:11 — forked from uraimo/dnsovertls.md
Configure your Mac to use DNS over TLS
@tianhuil
tianhuil / poetry_init.sh
Last active November 25, 2021 04:53
Poetry Install
# Poetry needs to be installed globally
poetry init
poetry add \
matplotlib \
pandas \
wordcloud \
tqdm \
python-dotenv \
@tianhuil
tianhuil / typeAssertions.ts
Created March 15, 2022 18:58
Type Assertions in typescript
// Type assertions, before I discovered https://www.npmjs.com/package/type-assertions
type AssertExtends<A, B> = A extends B ? true : false
export const assertExtends = <A, B>(_: AssertExtends<A, B>): void => {}
export const assertInstance = <B>(
a: any,
_: AssertExtends<typeof a, B>
): void => {}
assertExtends<'abc', string>(true)
@tianhuil
tianhuil / m1-deploy-heroku.md
Created May 20, 2023 18:43
Deploying to Heroku with a M1 Mac

From https://hackmd.io/@nirvana/deploy_python_m1

Build image with linux platform for heroku servers. Replace {NAME_OF_HEROKU_APP} with your own tag:

docker buildx build --platform linux/amd64 -t {NAME_OF_HEROKU_APP} .

Tag your app with the url for your apps registry. make sure to use the name of your Heroku app in the url and tag name:

docker tag {NAME_OF_HEROKU_APP} registry.heroku.com/{NAME_OF_HEROKU_APP}/web
@tianhuil
tianhuil / settings.json
Last active June 26, 2024 03:26
Python Template
{
// Common
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "explicit",
},
// Python
"python.analysis.typeCheckingMode": "basic",
"files.exclude": {
@tianhuil
tianhuil / README.md
Last active October 22, 2024 14:29
Migra + Supabase

Motivation

Supabase migrations are imperative. We want to declaratively write DB definitions declaratively and generate migrations as diffs. This tool accomplishes this.

Tool

This is a basic script to diff a set of schemas to generate new migrations for a supabase project. The expected file layout is

- supabase/baseline/baseline.sql
- supabase/migrations/[timestamp]_[name].sql
- supabase/schema/[order]_[name].sql
@tianhuil
tianhuil / iam.json
Created August 13, 2025 19:07
AWS IAM Root permissions minus billing
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
},
{
"Effect": "Deny",