Skip to content

Instantly share code, notes, and snippets.

View b0tting's full-sized avatar
🔠
(The most unpopular emoji according to Twitter)

Mark Otting b0tting

🔠
(The most unpopular emoji according to Twitter)
  • Delft, the Netherlands
View GitHub Profile
@b0tting
b0tting / gist:ee00a05223392e686be33fd4e0b3fb28
Created May 30, 2019 20:13
Fading lights that jump to blue when the sensor (LDR) triggers. Used to trigger other leds on a google home mini light.
#include <FastLED.h>
#define DATA_PIN 1
// On the ATTINY85, pins have different numbers when doing an analog reading compared to digital IO
#define SENSOR_PIN_A 1
#define SENSOR_PIN_D 2
#define NUM_LEDS 2
#define BRIGHTNESS 150
// Lower is slower
#define FRAMES_PER_SECOND 10
@b0tting
b0tting / letsencrypt_symlink_error.py
Last active January 19, 2021 23:37
Script to solve "/etc/letsencrypt/live/.../cert.pem to be a symlink Renewal configuration file /etc/letsencrypt/renewal/...conf is broken. " certbot problem.
@b0tting
b0tting / gitlab_clone_registry.py
Created December 18, 2023 10:11
Script used to move all container images from one Gitlab registry to another, including every tag. This script first pulls all containers with all tags to the system running the script, then retags with the new registry and pushes the images to the target repository.
import json
import sys
import requests
from docker.errors import DockerException
try:
import docker
except ImportError:
sys.exit("Please run 'pip install docker' first")
@b0tting
b0tting / DeleteKeyStorageItems.yml
Last active April 5, 2024 12:28
When working with the Rundeck key storage API you have a limited set of calls to work the tree with. I had a use case where I need to clear out a given path before syncing. This recursive ansible task walks the Rundeck key storag tree and deletes all items. Ansible will complain loudly about having to reuse the item loop_var, but you can safely …
- name: Calling out current path
debug:
msg: "Deleting path: {{ deleting_storage_path }}"
- name: Get path content
vars:
query_uri: "/api/{{ rundeck_api_version }}/storage/{{ deleting_storage_path }}/"
uri:
url: "{{ rundeck_url + (query_uri | urlencode) }}"
method: GET
@b0tting
b0tting / bgg_xml_api_demo.html
Last active May 5, 2024 18:42
An example of using the Boardgame Geek XML API to query, show a list of games and allow the user to select one
<html>
<head>
<title>Board game geek search demo</title>
</head>
<body>
<script>
</script>
<h1>Board game geek search demo</h1>
@b0tting
b0tting / gist:f1a83a8ecca42ae37cc2c40d6174cead
Last active July 5, 2024 09:13
Installing the AWS CFN helper scripts on Ubuntu 24.04. At the moment of writing, the aws-cfn-bootstrap-py3-latest.tar.gz helpers such as cfn-init and cfn-signal are not updated for python 3.12. A solution would be to use a virtual environment during bootstrapping or cloudinit.
# This should be able to run in cfn-init / EC2 userdata
export DEBIAN_FRONTEND=noninteractive
export VENV_DIR=/opt/aws/cfn-bootstrap-venv
export HELPER_SCRIPTS_BIN_DIR=/opt/aws/bin
# Install python 3.11 from deadsnakes, this will not be the default python, that will stay on 3.12
apt update
apt-get install -y tzdata software-properties-common # Maybe only required in docker?
add-apt-repository -y ppa:deadsnakes/ppa
apt update