Skip to content

Instantly share code, notes, and snippets.

View jesperronn's full-sized avatar

Jesper Rønn-Jensen jesperronn

View GitHub Profile
@ebidel
ebidel / sw_caching_size.js
Last active November 16, 2022 11:31
Print service worker cache sizes and overall bytes cached.
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*/
// Prints the bytes cached by service worker. Breaks out each cache
// overall in-memory bytes used by the Cache Storage API for the site.
async function getCacheStoragesAssetTotalSize() {
// Note: opaque (i.e. cross-domain, without CORS) responses in the cache will return a size of 0.
@blurayne
blurayne / ui-widget-select.sh
Last active May 21, 2025 20:15
Pure BASH interactive CLI/TUI menu (single and multi-select/checkboxes)
#!/bin/bash
##
# Pure BASH interactive CLI/TUI menu (single and multi-select/checkboxes)
#
# Author: Markus Geiger <[email protected]>
# Last revised 2019-09-11
#
# ATTENTION! TO BE REFACTORED! FIRST DRAFT!
#
@lauer
lauer / docker-entrypoint
Created April 23, 2025 09:44
simple docker entrypoint for rails project - check if database is up, from $DATABASE_URL which contains both port and hostname.
#!/bin/bash
set -e
# Extract hostname and port from DATABASE_URL
DB_HOST=$(echo $DATABASE_URL | sed -n 's/^.*[^@]*@\([^:]*\):[0-9]*.*$/\1/p')
DB_PORT=$(echo $DATABASE_URL | sed -n 's/^.*[^@]*@[^\:]*:\([0-9]*\).*$/\1/p')
# Wait for the database to be ready before starting the application
until nc -z -v -w30 $DB_HOST $DB_PORT; do