Skip to content

Instantly share code, notes, and snippets.

View oxc's full-sized avatar

Bernhard Frauendienst oxc

  • Munich, Germany
  • 01:44 (UTC +02:00)
View GitHub Profile
@oxc
oxc / pattern.py
Created June 29, 2020 12:13
pattern.py
#!/usr/bin/env python
import sys
PATTERNS = [
("19,28 1 5","18,12 2 3","19,5 1 2","18,1 4 3","18,22 1 2","18,4 3 2","18,6 1 3"),
("19,2 4 1","18,1 4 3","19,5 1 2","19,12 1 3","19,6 11 1","18,22 1 2","18,15 1 2","19,12 1 3"),
("19,28 1 5","19,5 1 2","18,22 1 2","18,22 1 2","18,10 22 1","18,36 2 4","19,5 1 2","18,20 19 2"),
("19,5 1 2","18,20 19 2","19,6 11 1","18,1 4 3","18,10 22 1","18,20 19 2","18,1 3 1"),
("18,12 2 3","18,10 22 1","18,10 22 1","19,6 11 1","18,4 3 2","18,1 4 3"),
@oxc
oxc / NodeModulesLayerPlugin.mjs
Created April 27, 2023 13:54
esbuild plugin to mark only (some) top-level node_modules as external
/**
* @typedef {Object} NodeModulesLayerPluginOptions
* @property {string[]} [layerModules]
*/
const recursionFlag = Symbol.for('$NodeModulesLayerPlugin_recursion')
/**
* This is an esbuild plugin which marks all imports that are included in a NodeModulesLayer as external.
*
@oxc
oxc / node-execv.ts
Last active July 30, 2024 01:05
Call execv (works similar for execvp, execve) on Node 20
import ref from "ref-napi";
import ffi from "ffi-napi";
import ref_array_di from "ref-array-di";
const ArrayType = ref_array_di(ref);
const StringArray = ArrayType("string");
// from fcntl.h
const F_GETFD = 1; /* get close_on_exec */
@oxc
oxc / days_at_address.sh
Created August 23, 2024 12:06
Find all days in Google Location History on which you have been at a certain address
# Find all unique days in your Google Takeout Semantic Location History
# on which you have been at a specific address.
#
# Usage: days_at_address <addr> [history files...]
#
# Example:
#
# $ cd "Takeout/Location History (Timeline)/Semantic Location History"
# $ days_at_address "Königsplatz 1, 80333 München, Deutschland" 2023/*.json
# Output: