Skip to content

Instantly share code, notes, and snippets.

View rubensa's full-sized avatar
💭
¯\(°_o)/¯ ¯\_(ツ)_/¯

Ruben Suarez Alvarez rubensa

💭
¯\(°_o)/¯ ¯\_(ツ)_/¯
View GitHub Profile
@rubensa
rubensa / bash_strict_mode.md
Created August 3, 2023 12:02 — forked from vncsna/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@rubensa
rubensa / docker-multiarch-custom-builder.sh
Created August 9, 2023 10:03
Docker multiarch custom builder
#!/usr/bin/env bash
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name multiarch --driver docker-container --use
docker buildx inspect --bootstrap
@rubensa
rubensa / who_is_my_mummy.sh
Created September 19, 2023 06:44 — forked from joechrysler/who_is_my_mummy.sh
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works:
@rubensa
rubensa / index.html
Created November 3, 2023 07:44 — forked from miguelmota/index.html
Swagger UI authorization header bearer access token
<script>
window.onload = function() {
fetch('./swagger.json')
.then(function(response) {
response.json()
.then(function(json) {
json.schemes[0] = window.location.protocol.slice(0, -1)
json.host = window.location.host
const ui = SwaggerUIBundle({