Skip to content

Instantly share code, notes, and snippets.

[Unit]
Description=Start servercheck script
After=network-online.target
[Service]
Type=simple
ExecStart=/opt/servercheck.sh
[Install]
WantedBy=multi-user.target
@Bouni
Bouni / status.py
Last active December 22, 2020 09:17
Get dominant color from an image and determin the operating state of a decalcifying device
import io
import sys
import os
from colorthief import ColorThief
from PIL import Image
original = Image.open(sys.argv[1])
left = 950
right = left + 50
@Bouni
Bouni / cam.sh
Last active December 22, 2020 09:16
use raspistill to take a picture from the RaspberryPi camera, then call processing script
#!/bin/bash
now=$(date +"%Y-%m-%dT%H-%M-%S")
file="/home/pi/bwt-${now}.jpg"
raspistill -vf -hf -t 1000 -o $file
python3 /home/pi/status.py $file
@Bouni
Bouni / usde
Last active November 1, 2020 15:34
xkb file for German Umlauts on US keyboard
# Place this file in /usr/share/X11/xkb/symbols/usde
# Load it with setxkbmap -model pc105 -layout usde -variant intlde -option caps:none
default partial alphanumeric_keys modifier_keys
xkb_symbols "basic" {
name[Group1]= "English (US)";
key <TLDE> { [ grave, asciitilde ] };
key <AE01> { [ 1, exclam ] };
@Bouni
Bouni / colors.bash
Created October 31, 2020 19:16
Bash Variable with all 256 colors as foreground and background
FG0='\e[38;5;0m'
FG1='\e[38;5;1m'
FG2='\e[38;5;2m'
FG3='\e[38;5;3m'
FG4='\e[38;5;4m'
FG5='\e[38;5;5m'
FG6='\e[38;5;6m'
FG7='\e[38;5;7m'
FG8='\e[38;5;8m'
FG9='\e[38;5;9m'
@Bouni
Bouni / gist:b18621d46f0af29389630e9dd612880a
Created October 20, 2020 20:20
NixOS full disk encryption
sudo su
sgdisk -o -g -n 1::+550M -t 1:ef00 -n 2:: -t 2:8300 /dev/nvme0n1
cryptsetup luksFormat --type luks1 /dev/nvme0n1p2
cryptsetup open /dev/nvme0n1p2 lvm
pvcreate /dev/mapper/lvm
vgcreate vg /dev/mapper/lvm
lvcreate -L 32G -n swap vg
@Bouni
Bouni / traefik-extractor.py
Last active April 14, 2020 18:13
Extract pem files from traefiks acme.json
import sys
import os
import errno
import json
from base64 import b64decode
def extract(file, output, challenge):
# Read JSON file
data = json.loads(open(file).read())
@Bouni
Bouni / notes.md
Created March 31, 2020 09:00
PowerCommander USB Boot Setup
@Bouni
Bouni / corona.py
Last active April 3, 2020 07:35
A Corona Virus status plugin for py3status bar
# -*- coding: utf-8 -*-
"""
A corona virus status plugin for py3status.
Save this into ~/.config/py3status/modules/corona.py
This is static for Germany and gets its data from https://github.com/sagarkarira/coronavirus-tracker-cli
Can be easily changed for a different country by changing the requests url below.
"""
import requests
@Bouni
Bouni / py3status.config
Created March 9, 2020 21:14
py3status.config
# github.com/bouni i3status/py3status config
# i3status configuration file
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!