Skip to content

Instantly share code, notes, and snippets.

View goncalomb's full-sized avatar
💾
flopping around

Gonçalo MB goncalomb

💾
flopping around
View GitHub Profile
@goncalomb
goncalomb / grafana-kiosk
Created May 12, 2019 15:40
Startup script to create Grafana based kiosks.
#!/bin/bash
# Copyright (c) 2019 Gonçalo Baltazar <me@goncalomb.com>
# MIT License
# Grafana Dashboard Kiosk using Google Chrome (or Chromium)
# opens an independent google chrome instance with a custom
# extension that injects Authorization headers for grafana
@goncalomb
goncalomb / k8s-node-gate.sh
Last active October 6, 2022 10:58
Open a root shell on a Kubernetes cluster Node (no ssh).
#!/bin/sh
# Copyright (c) 2019 Gonçalo Baltazar <me@goncalomb.com>
# MIT License
# Open a root shell on a Kubernetes cluster Node (no ssh).
# It uses a privileged container to unlock Linux capabilities and chroot to
# change into the root filesystem of the Node for full access.
@goncalomb
goncalomb / ytdl-max-dump.sh
Last active August 20, 2020 20:43
download all youtube channel videos with maximum information
#!/bin/bash
# Copyright (c) 2020 Gonçalo Baltazar <me@goncalomb.com>
# MIT License
# download all youtube channel videos with maximum information
# pip3 install --upgrade youtube-dl
# ffmpeg -y -loglevel repeat+info -i file:video.xyz -i file:audio.xyz -c copy -map 0:v:0 -map 1:a:0 file:out.mkv
@goncalomb
goncalomb / install-snapraid.sh
Created October 4, 2020 21:32
Compile and Install SnapRAID on Linux (tested on Mint and Raspberry Pi OS). Requires make, gcc and friends...
#!/bin/bash
set -ex
mkdir -p snapraid
cd snapraid
REL_JSON=$(curl -sS "https://api.github.com/repos/amadvance/snapraid/releases/latest" | grep browser_download_url)
if [[ ! "$REL_JSON" =~ \"browser_download_url\":\ \"https:\/\/github.com\/[^\"]+\/releases\/download\/v([^\"]+)\/(snapraid-[^\"]+.tar.gz)\" ]]; then
@goncalomb
goncalomb / ytdl-ii.sh
Last active October 17, 2022 20:33
Another YouTube downloader script.
#!/bin/bash
# Copyright (c) 2021 Gonçalo Baltazar <me@goncalomb.com>
# MIT License
# pip3 install --upgrade youtube-dl
# ffmpeg -y -loglevel repeat+info -i file:video.xyz -i file:audio.xyz -c copy -map 0:v:0 -map 1:a:0 file:out.mkv
set -eo pipefail
cd -- "$(dirname -- "$0")"
@goncalomb
goncalomb / git-mtime
Created January 19, 2022 19:04
Save file modification times on git repository.
#!/bin/bash
set -e
# check if is valid repo
git rev-parse HEAD >/dev/null
# cd to top level
cd -- "$(git rev-parse --show-toplevel)"
@goncalomb
goncalomb / ps-names
Last active May 18, 2022 21:27
Script to rename PSX and PS2 rom files.
#!/bin/env python3
# Copyright (c) 2022 Gonçalo Baltazar <me@goncalomb.com>
# MIT License
import os, argparse, shutil, tempfile, requests, zipfile
import xml.etree.ElementTree as ET
tmp_dir = os.path.join(tempfile.gettempdir(), 'ps-names')
datfile_list = [
@goncalomb
goncalomb / hue.js
Last active November 16, 2022 20:55
A Shelly Script to control Hue lights without the cloud.
// control a hue lights group from a shelly device, without the cloud
// for shelly gen2 devices that have script support
// author: goncalomb <me@goncalomb.com>
// year: 2022
// 1. use the hue debugger (clip.html) to create a new username (POST to /api), see below
// 2. change HUE_URL and HUE_USERNAME
// 3. optionally change HUE_GROUP, SHELLY_INPUT and EDGE_SWITCH
// 4. add the script to your shelly (web ui)
// 5. done
@goncalomb
goncalomb / bully-music-extractor.sh
Created December 29, 2022 20:52
Extract music/audio from 'Bully: Scholarship Edition' on PC.
#!/bin/bash
# Copyright (c) 2022 Gonçalo Baltazar <me@goncalomb.com>
# MIT License
# Extract music/audio from 'Bully: Scholarship Edition' on PC.
# This script expects the game to be installed on Linux using Steam.
# Use Proton to install Bully on Steam, then run the script:
# - Open the game properties
@goncalomb
goncalomb / normalize_face.FCMacro
Last active February 15, 2023 23:03
FreeCAD macro to normalize imported faces (tested with svg paths).
# Copyright (c) 2023 Gonçalo Baltazar <me@goncalomb.com>
# MIT License
# this macro can be used to manipulate face geometry (scale and origin vertex)
# it was specially made to rescale imported faces (e.g. svg)
# imported geometry may have undesired scale and position, depending on the
# original file (positions, translations, dpi etc.)
# after importing, select a single face vertex and run the macro