Skip to content

Instantly share code, notes, and snippets.

@spuf
spuf / Caddyfile
Created December 7, 2021 08:57
https localhost
:443
log
# openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -extensions EXT -config <( printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
tls localhost.crt localhost.key
reverse_proxy 127.0.0.1:3000
@spuf
spuf / macos-multipass-docker.sh
Last active October 31, 2022 08:24
macos multipass docker
brew install multipass
multipass launch lts -c 6 -d 20G -m 8G -n docker
multipass set client.primary-name=docker
multipass mount /Volumes/path/to/repo docker
multipass shell
curl -sSL https://get.docker.com/ | sh
echo '{"features": {"buildkit": true}}' > /etc/docker/daemon.json
sudo systemctl restart docker.service
@spuf
spuf / docexe.sh
Created February 3, 2019 06:31
Docker image as executable
set -euo pipefail
if [[ -t 0 ]]; then
arg_tty="--tty"
else
arg_attach="--attach stdin --attach stdout --attach stderr"
fi
exec docker run -w="$(pwd)" --volume=/tmp/:/tmp/ --volume=$HOME/:$HOME/ --volume=/Volumes/:/Volumes/ --net=host --rm --interactive ${arg_tty-} ${arg_attach-} "${@}"
@spuf
spuf / restore chmod.sh
Created April 24, 2016 12:32
Restore chmod recursively
chmod -R u=rwX,go=rX .
find . -type f -exec chmod -x {} \;
chmod -R -N .
@spuf
spuf / Ghost in the Shell.md
Created November 25, 2015 10:09
Ghost in the Shell

Ghost in the Shell

Films

  • Ghost in the Shell (1995) = Ghost in the Shell 2.0 (2008)
  • Ghost in the Shell 2: Innocence (2004)

TV series

@spuf
spuf / daylight.md
Last active August 29, 2015 14:22
Calculate efficient daylight regime

Calculate efficient daylight regime

Find the cheapest light regime for defined daylight time.

Input data

Daylight: 18 hours.