Skip to content

Instantly share code, notes, and snippets.

@simonflk
simonflk / resume.json
Last active June 26, 2025 14:20
resume.json
{
"$schema": "https://jsonresume.org/schema.json",
"basics": {
"name": "Simon Flack",
"label": "Product Engineer – Full-stack (TypeScript, Node, React)",
"location": {
"city": "Jelenia Góra",
"countryCode": "PL"
},
"profiles": [
@simonflk
simonflk / gist:492045632be26f075e75020c59beac24
Last active January 5, 2024 18:13
Burn subtitles into video & make it portrait
VIDEO=~/Downloads/video.mp4 \
SRT=/Users/simon/Downloads/video.srt \
OUTPUT=~/Downloads/video-with-subtitles.mp4 \
ffmpeg -i $VIDEO \
-vf "crop=360:640:(iw-370)/2:(ih-640)/2,subtitles=${SRT}:force_style='FontSize=14,MarginV=20'" \
-c:a copy $OUTPUT
@simonflk
simonflk / crop-video.sh
Created September 19, 2023 14:12
Crop a video to 9:16
#!/bin/bash
input_file="$1"
dir_name=$(dirname "$input_file")
base_name=$(basename "$input_file")
output_file="$dir_name/cropped_$base_name"
# Fetch video dimensions
width=$(ffprobe -v error -select_streams v:0 -show_entries stream=width -of default=nw=1:nk=1 "$input_file")
height=$(ffprobe -v error -select_streams v:0 -show_entries stream=height -of default=nw=1:nk=1 "$input_file")
@simonflk
simonflk / console-log-unformatted.ts
Created June 19, 2023 14:20
console.log() without formatting
/**
* This is incomplete, but it attempts to remove special formatting before logging.
* This is useful because some runtimes like Sentry which intercept console.log
* Do not support all the console.log features available in the browser
*
* @see https://developer.chrome.com/docs/devtools/console/format-style/
*/
function debug(...params: Parameters<(typeof console)['log']>) {
if (process.env.NODE_ENV === 'development') {
@simonflk
simonflk / CurriedReactHandler.ts
Created September 15, 2021 09:16
Typescript generic type for a react update handler in the form `handleUpdate('type')(value)`
type Duration = "0-2" | "2-5" | "5+"
type FilterQuery = {
durations: Set<Duration>,
authors: Set<string>,
tags: Set<number>
}
type CurriedReactHandler<Model> = <T extends keyof Model>(
type: T,
@simonflk
simonflk / machine.js
Created June 8, 2020 15:02
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
send(
{
type: "APPRECIATION_RECOGNISED",
for: [
"XState", // game-changer
"use-effect-reducer", // so useful
"@keyframers", // educational
"tweets", // hilarious, keep 'em coming
],
},
@simonflk
simonflk / xstate-fasttrack.js
Last active April 10, 2020 16:05
Delay Repay: FastTrack Machine
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@simonflk
simonflk / xstate-fare-finder-destination.js
Last active April 10, 2020 16:10
XState: destination fare machine
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@simonflk
simonflk / machine.js
Last active February 20, 2020 18:12
XState Visualizer: Find nearest station
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions