Skip to content

Instantly share code, notes, and snippets.

@Bouni
Bouni / output.txt
Created November 27, 2024 07:24
Attiny1616 PB5 problem
pio run -v -j1
Processing udpi (upload_flags: --tool, uart, --device, $BOARD_MCU, --uart, $UPLOAD_PORT, --clk, $UPLOAD_SPEED; upload_command: pymcuprog write --erase $UPLOAD_FLAGS --filename $SOURCE; platform: atmelmegaavr; board: ATtiny1616; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/ATtiny1616.html
PLATFORM: Atmel megaAVR (1.9.0) > ATtiny1616
HARDWARE: ATTINY1616 16MHz, 2KB RAM, 16KB Flash
PACKAGES:
- framework-arduino-megaavr-megatinycore @ 2.6.7
- toolchain-atmelavr @ 3.70300.220127 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
@Bouni
Bouni / checkmk-docker-plugin-setup.txt
Created October 17, 2024 08:19
Install CheckMK Plugin inside a docker installation of CheckMK
docker exec -ti -u cmk checkmk bash
cd tmp
curl -O https://exchange.checkmk.com/packages/nut/1230/nut-2.0.4.mkp
OMD[cmk]:~/tmp$ mkp add nut-2.0.4.mkp
nut 2.0.4
OMD[cmk]:~/tmp$ mkp enable nut
[nut 2.0.4]: Installing
@Bouni
Bouni / ethercat-conf.xml
Created September 13, 2024 11:38
First working draft of a 3 axis linuxcnc setup with Omron 1S servo drives over ethercat
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="-1" name="master0">
<slave idx="0" type="EK1110" />
<slave idx="1" type="R88D-1SN01H-ECT" name="x-servo">
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<watchdog divider="2498" intervals="1000"/>
</slave>
<slave idx="2" type="R88D-1SN01H-ECT" name="y-servo">
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<watchdog divider="2498" intervals="1000"/>
"""Implementation of the Datamodel for the parts list with natural sort."""
import re
import wx
import wx.dataview as dv
BOM_COL = 6
POS_COL = 7
import wx
import wx.dataview as dv
from datamodel import PartListDataModel
import random
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="DataViewCtrl Example with Natural Sort")
import wx
import wx.dataview as dv
import re
import random
def natural_sort_key(s):
"""Return a tuple that can be used for natural sorting."""
return [
int(text) if text.isdigit() else text.lower()
@Bouni
Bouni / GMOD.py
Last active June 13, 2024 07:37
Read SICK FlexiSoft GMOD gateway data using pymodbus
# See https://cdn.sick.com/media/docs/6/86/086/Operating_instructions_Flexi_Soft_Gateways_in_the_Safety_Designer_Configuration_software_de_IM0081086.PDF
# Page 36
from pymodbus.client import ModbusTcpClient as ModbusClient
IP = "192.168.255.3"
PORT = 502
ADDRESS = 1100
REGISTERS = 25
SLAVE_ID = 1
@Bouni
Bouni / nc-transfer.sh
Last active March 19, 2024 13:12
Transfer Nextcloud data to new server
#!/bin/sh
NEW_HOST=new_server
TARGET_FOLDER=/opt/docker/cloud/transfer/
MYSQL_USER=nextcloud
MYSQL_PW=my_secure_db_pw
DATE=`date +"%Y%m%d"`
@Bouni
Bouni / svg2pdf.ps1
Last active November 6, 2023 09:17
Batch convert SVG files to PDF on Windows 11
$files = Get-ChildItem -Name ./*.svg
for ($i=0; $i -lt $files.Count; $i++) {
$newname = ([String]$files[$i]).Replace("svg","pdf")
& "C:\Program Files\Inkscape\bin\inkscape.exe" --actions="export-type:pdf;export-do" --export-filename=$newname $files[$i]
}
@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