Skip to content

Instantly share code, notes, and snippets.

Avatar
🌌
☀️🛰☁️🌈

Tjerk Woudsma woudsma

🌌
☀️🛰☁️🌈
View GitHub Profile
@woudsma
woudsma / dokku-dockerfile-github-actions-deploy.yml
Last active Jul 24, 2021
Deploy project with Dockerfile to Dokku using Github Actions and Github Container Registry (ghcr.io). Deploy either staging or production based on branch.
View dokku-dockerfile-github-actions-deploy.yml
# Example repository with Dockerfile and NGINX config: https://github.com/woudsma/es6-boilerplate
name: Deploy to Dokku
on:
pull_request:
types:
- closed
branches:
- develop
@woudsma
woudsma / gitignore.sh
Last active Jul 10, 2020
gitignore command line function
View gitignore.sh
function gitignore() {
TAGS="${@}"
TAGS="${TAGS/mac/macos}"
GITIGNORE_IO_URL="https://www.toptal.com/developers/gitignore/api/${TAGS// /,}"
GITIGNORE_FILE="$(pwd)/.gitignore"
echo "--> Fetching: $GITIGNORE_IO_URL"
echo "--> Writing: $GITIGNORE_FILE"
curl -fsSL "$GITIGNORE_IO_URL" >> "$GITIGNORE_FILE"
}
View samizdat-shell-help.bash
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@woudsma
woudsma / static-video-live-stream-twitch-ffmpeg.sh
Last active Sep 17, 2019
static video to realtime live stream to twitch with ffmpeg - quick n dirty
View static-video-live-stream-twitch-ffmpeg.sh
# Quick and dirty script for streaming a video file to Twitch (as if it were live)
# Requirements: ffmpeg (http://www.ffmpeg.org)
# Copy-paste the function and call it in your command line
# Or add the function to ~/.bash_profile, ~/.zshrc, ..etc.
# Usage:
# twitch STREAM_KEY FILEPATH
# Example:
View dokku-add-user.md

Dokku ACL plugin

# Dokku host
dokku plugin:install https://github.com/dokku-community/dokku-acl.git acl

dokku ssh-keys:add guest guest-key.pub
dokku ssh-keys:list

mkdir ~dokku/.dokkurc
echo "export DOKKU_ACL_ALLOW_COMMAND_LINE=1" >> ~dokku/.dokkurc/acl
View lazy-cartesian-product.py
import math
from bigfloat import *
class LazyCartesianProduct:
def __init__(self, sets, context):
self.sets = sets
self.context = context
self.divs = []
self.mods = []
self.maxSize = BigFloat.exact(1)
@woudsma
woudsma / retrain-mobilenet-for-the-web.md
Last active Nov 1, 2022
Retrain a MobileNet model for the web with TensorFlow for Poets and TensorFlow.js
View retrain-mobilenet-for-the-web.md

Retrain a MobileNet model and use it in the browser with TensorFlow.js

DRAFT

Combining TensorFlow for Poets and TensorFlow.js.
Retrain a MobileNet V1 or V2 model on your own dataset using the CPU only.
I'm using a MacBook Pro without Nvidia GPU.

MobileNets can be used for image classification. This guide shows the steps I took to retrain a MobileNet on a custom dataset, and how to convert and use the retrained model in the browser using TensorFlow.js. The total time to set up, retrain the model and use it in the browser can take less than 30 minutes (depending on the size of your dataset).

Example app - HTML/JS and a retrained MobileNet V1/V2 model.

View ffmpeg-composite-video-audio-fade.sh
#!/bin/bash
echo "Compositing files and ramping up video framerate"
echo "================================================"
rm -rf render && mkdir render
for file in *.mov; do
# Ramp up video framerate, add audio
ffmpeg \
@woudsma
woudsma / k-d-tree.md
Last active Feb 19, 2018
Javascript k-d-tree
View k-d-tree.md
npm i k-d-tree
const kd = require('k-d-tree')

const data = new Array(1000)
  .fill()
  .map(() => ({
 type: "Point",
@woudsma
woudsma / dokku-postgres-postgis.md
Created Jan 17, 2018
Using the PostGIS extension on a PostgreSQL database with Dokku
View dokku-postgres-postgis.md

Using the PostGIS extension on a PostgreSQL database with Dokku

docker pull mdillon/postgis:latest  
export POSTGRES_IMAGE="mdillon/postgis"  
export POSTGRES_IMAGE_VERSION="latest"  
dokku postgres:create my-postgis-db