This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# To the extent possible under law, Viktor Szakats (vsz.me) | |
# has waived all copyright and related or neighboring rights to this | |
# script. | |
# CC0 - https://creativecommons.org/publicdomain/zero/1.0/ | |
# This script will create a self-signed root certificate, along with a code | |
# signing certificate in various formats, trying to use the best available | |
# crypto/practice all along. Then, it will create a test executable and code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## win10 line endins | |
*.bat eol=crlf | |
*.ps1 eol=crlf | |
## Linux/Posix line endins | |
*.go eol=lf | |
*.sh eol=lf | |
*.source eol=lf | |
Makefile eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# non root user example for alpine | |
# | |
# usage: | |
# $ docker build --build-arg "USER=someuser" --tag test . | |
# $ docker run --rm test | |
# or | |
# docker run --user default --rm -it alpine:latest | |
# docker run --user nobody --rm -it alpine:latest | |
FROM alpine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Do initial configuration of a SP111 plug on your local wifi | |
# | |
# Licensed under the GPLv3+ | |
# | |
TEMPLATE='{"NAME":"SP111 v1.1","GPIO":[56,0,158,0,132,134,0,0,131,17,0,21,0],"FLAG":0,"BASE":45}' | |
function uriencode { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# The last argument is the command to be executed on the remote end, which is something | |
# like "git-upload-pack 'webfactory/ssh-agent.git'". We need the repo path only, so we | |
# loop over this last argument to get the last part of if. | |
for last in ${!#}; do :; done | |
# Don't use "exec" to run "ssh" below; then the trap won't work. | |
key_file=$(mktemp -u) | |
trap "rm -f $key_file" EXIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# (c) Artur.Klauser@computer.org | |
# | |
# This script tries to reregister QEMU's binfmt_misc handlers with the | |
# fix-binary (F) flag in order to be usable with 'docker buildx' to build | |
# multi-architecture images. | |
# For more information see: | |
# https://nexus.eddiesinentropy.net/2020/01/12/Building-Multi-architecture-Docker-Images-With-Buildx/ | |
function remove_binfmt() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# (c) Artur.Klauser@computer.org | |
# | |
# This script checks if all software requirements are met in a Linux environment | |
# in order to use 'docker buildx' to build multi-architecture images. | |
# For more information see: | |
# https://nexus.eddiesinentropy.net/2020/01/12/Building-Multi-architecture-Docker-Images-With-Buildx/ | |
set -vx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# (c) Artur.Klauser@computer.org | |
# | |
# This script installs support for building multi-architecture docker images | |
# with docker buildx on CI/CD pipelines like Github Actions or Travis. It is | |
# assumed that you start of with a fresh VM every time you run this and have to | |
# install everything necessary to support 'docker buildx build' from scratch. | |
# | |
# Example usage in Travis stage: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Cleanup docker files: untagged containers and images. | |
# | |
# Use `docker-cleanup -n` for a dry run to see what would be deleted. | |
untagged_containers() { | |
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1. | |
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6). | |
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470 | |
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
# sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
NewerOlder