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 / 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({
@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 / 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 / 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 / private_fork.md
Created September 7, 2022 12:30 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@rubensa
rubensa / pipewire.md
Created April 1, 2022 18:46 — forked from the-spyke/pipewire.md
Enable PipeWire on Ubuntu 21.10

Enable PipeWire on Ubuntu 21.10

Ubuntu 21.10 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use it for audio and Bluetooth instead of PulseAudio.

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA, you might get into conflicts.

Based on the Debian Wiki, but adopted for Ubuntu 21.10.

Install

Configure systemd-resolved to use a specific DNS nameserver for a given domain

Use case

Given

  • I use a VPN to connect to my work network
  • I'm on a Linux computer that uses systemd-resolved
  • I have a work domain called example.com
  • example.com is hosted by both public and private DNS nameservers
@rubensa
rubensa / uncheck-checkboxes.js
Last active December 14, 2021 05:35
Chrome DevTools Snippet to click on an element and uncheck all contained checkboxes.
// uncheck-checkboxes.js
// https://gist.github.com/rubensa/5128d5c8b85eb82ca970d89222693128
// Chrome DevTools Snippet to click on an element and uncheck all contained checkboxes.
// Starting Firefox 72, you can import a Javascript file content in the console input with Ctrl + O (Cmd + O on macOS), as well as saving the console input content to a file using Ctrl + S (Cmd + S on macOS).
(function() {
function uncheckCheckboxes(e) {
e.preventDefault();
e.stopPropagation();
window.removeEventListener('mousedown', uncheckCheckboxes, true);
@rubensa
rubensa / kubernetes.md
Created December 9, 2021 11:17 — forked from sonoroot/kubernetes.md
kubernetes notes

Kubernetes Notes

Busybox Debug

kubectl run busybox --image=busybox:1.28 --rm -it --restart=Never -- sh
kubectl run test --image=alpine:latest --rm -it --restart=Never -- sh
@rubensa
rubensa / ttf-wine-tahoma-installer.sh
Created September 9, 2020 06:27 — forked from maxwelleite/ttf-wine-tahoma-installer.sh
Script to install the latest Wine Tahoma fonts on Ubuntu distros
#!/bin/bash
# Author: Maxwel Leite
# Website: http://needforbits.wordpress.com/
# Description: Script to install the latest Wine Tahoma Regular and Wine Tahoma Bold fonts on Ubuntu distros from the Wine Project.
# The Wine project includes the free and open-source fonts Wine Tahoma Regular and Wine Tahoma Bold released under LGPL
# designed to have identical metrics to the Microsoft Tahoma font. This was done because Tahoma is available by default
# on Windows, and many applications expect the font to be available.
# Dependencies: wget
# Tested: Ubuntu Saucy/Trusty/Xenial