Skip to content

Instantly share code, notes, and snippets.

@Bouni
Bouni / rainbow.py
Created November 1, 2023 10:35
Generate a list of rainbow colors with n entries
def rainbow_color_stops(n=10, end=2 / 3):
rgb = [hls_to_rgb(end * i / (n - 1), 0.5, 1) for i in range(n)]
hex = [f"#{int(255.0*r):02x}{int(255.0*g):02x}{int(255.0*b):02x}" for r, g, b in rgb]
return hex
@Bouni
Bouni / nc_last_seen.py
Created October 26, 2023 15:13
Hacky python script to get a list uf all Nextcloud users ordered by their last login (for use with docker-compose)
from subprocess import Popen, PIPE
from datetime import datetime as dt
import json
occ = ["docker-compose", "exec", "-u", "www-data", "app", "/var/www/html/occ"]
list_users_cmd = occ + ["user:list", "--output=json"]
with Popen(list_users_cmd, stdout=PIPE) as proc:
users = json.loads(proc.stdout.read().decode("UTF-8"))
@Bouni
Bouni / doco.sh
Created July 25, 2023 13:31
A shell script to handle mutiple docker-compose files easily
#!/bin/sh
case $1 in
"update" )
docker-compose $(find . -maxdepth 2 -name compose.*.yaml -type f -print | sed -e 's/^/-f /') pull --ignore-pull-failures && \
docker-compose $(find . -maxdepth 2 -name compose.*.yaml -type f -print | sed -e 's/^/-f /') up -d;;
"status" )
docker-compose $(find . -maxdepth 2 -name compose.*.yaml -type f -print | sed -e 's/^/-f /') ps -a;;
"lf" )
docker-compose $(find . -maxdepth 2 -name compose.*.yaml -type f -print | sed -e 's/^/-f /') logs -f ${@:2};;
@Bouni
Bouni / blocky-dashboard.json
Created June 29, 2023 15:17
Blocky Grafana Dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
@Bouni
Bouni / PKGBUILD
Created June 20, 2023 07:34
Arch Linux package for Kicad nightly bin
# Maintainer: Andy Makovec <andymakovec[at]gmail[dot]com>
# Contributor: Rachel Mant <dx-mon[at]users[dot]sourceforge[dot]net>
# Contributor: Bouni <bouni-aur[at]owee[dot]de>
pkgname=kicad-nightly-bin
_pkgname=kicad-nightly
provides=('kicad-nightly')
conflicts=('kicad-nightly')
pkgdesc='Electronic schematic and printed circuit board (PCB) design tools'
arch=('x86_64')
@Bouni
Bouni / print256colours.sh
Created June 9, 2023 08:58 — forked from HaleTom/print256colours.sh
Print a 256-colour test pattern in the terminal
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256
@Bouni
Bouni / .p10k.zsh
Created May 30, 2023 09:05
Custom Powerlevel10K color scheme
# Generated by Powerlevel10k configuration wizard on 2023-05-30 at 10:41 CEST.
# Based on romkatv/powerlevel10k/config/p10k-classic.zsh, checksum 09432.
# Wizard options: nerdfont-complete + powerline, large icons, classic, unicode, dark,
# 24h time, angled separators, sharp heads, flat tails, 1 line, compact, many icons,
# fluent, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate
# your own config based on it.
#

List of all supported devices

Currently 355 devies are supported.

Manufacturer Device Implemented Tested
Beckhoff AX5101-0000-0003
Beckhoff AX5101-0000-0004
Beckhoff AX5101-0000-0005
Beckhoff AX5101-0000-0006
@Bouni
Bouni / git_fix_author_name.txt
Created May 12, 2023 11:36
change author af several commits back
1. git rebase -i <hash_of_last_good_commit>
2. change prefix to edit
3. git commit --amend --author="Bouni <[email protected]>" --no-edit
4. git rebase --continue
Do steps 3 and 4 for every commit
@Bouni
Bouni / EP23XX-PDO.txt
Last active May 3, 2023 10:34
Beckhoff EP23XX PDOs
======================================EP2308======================================
====================================Input PDOs====================================
1 Name: Input Index: 0x6000 SubIndex: 1 BitLength: 1 Datatype: BOOL
2 Name: Input Index: 0x6010 SubIndex: 1 BitLength: 1 Datatype: BOOL
3 Name: Input Index: 0x6020 SubIndex: 1 BitLength: 1 Datatype: BOOL
4 Name: Input Index: 0x6030 SubIndex: 1 BitLength: 1 Datatype: BOOL
===================================Output PDOs====================================
1 Name: Output Index: 0x7040 SubIndex: 1 BitLength: 1 Datatype: BOOL
2 Name: Output Index: 0x7050 SubIndex: 1 BitLength: 1 Datatype: BOOL