Skip to content

Instantly share code, notes, and snippets.

@TheStaticTurtle
TheStaticTurtle / M62429.py
Last active March 1, 2021 00:49
CircuitPython library for the M62429 volume controller IC
import digitalio
import time
class M62429(object):
"""docstring for MS62429"""
def __init__(self, pin_data, pin_clock, speed=0.001):
super(M62429, self).__init__()
self.pin_data = digitalio.DigitalInOut(pin_data)
self.pin_data.direction = digitalio.Direction.OUTPUT
self.pin_clock = digitalio.DigitalInOut(pin_clock)
@TheStaticTurtle
TheStaticTurtle / MCP4XXX.py
Created March 1, 2021 18:20
CircuitPython library for the MCP4XXX familly
import digitalio
def enum(**enums):
return type('Enum', (), enums)
Port = enum(P0=0b00, P1=0b01)
Resolution = enum(BIT_7=127, BIT_8=255)
Wiper = enum(Rheostat=0, Potentiometer=1)
ADDRESS_MASK = 0B11110000
@TheStaticTurtle
TheStaticTurtle / rsyslog.conf
Created August 26, 2021 17:01
Rrsyslog remote logging conf
# Load Modules
module(load="imudp")
module(load="imuxsock")
# rsyslog Templates
template(name="FilePathHostnameFormat" type="string" string="/var/log/net/%hostname%/syslog.log")
template(name="FilePathIpFormat" type="string" string="/var/log/net/%fromhost-ip%/syslog.log")
template(name="RemoteFormat" type="list") {
property(name="timegenerated" dateformat="day")
@TheStaticTurtle
TheStaticTurtle / minimal_syslog_server_stormshield_fierwall.py
Last active November 16, 2021 16:18
StormShield Firwall Minimal Syslog Server
HOST, PORT = "0.0.0.0", 5514
import logging,coloredlogs,socketserver
coloredlogs.install(level=logging.DEBUG, fmt='%(message)s', datefmt='')
#Remove theses values from the log
filter_proto = ["dns_udp", "dns_tcp", "ssdp", "bootps", "ntp"]
filter_dstname = []#["firefox", "github", "google", "msedge", "imgur", "cdn."]
filter_srcname = []
@TheStaticTurtle
TheStaticTurtle / patch.diff
Last active January 14, 2022 12:01
FileZilla patch to increase the ridiculous 10 simultaneous connections limit
diff settings/optionspage_transfer.cpp settings/optionspage_transfer.cpp
52,53c52,54
< impl_->transfers_->SetRange(1, 10);
< impl_->transfers_->SetMaxLength(2);
---
> #warning Here
> impl_->transfers_->SetRange(1, 500);
> impl_->transfers_->SetMaxLength(3);
55c56
< inner->Add(new wxStaticText(box, nullID, _("(1-10)")), lay.valign);
@TheStaticTurtle
TheStaticTurtle / decode_onmessage.js
Last active February 8, 2022 01:26
Nodered VBAN header decoder
input_buffer = msg.payload
msg.payload = {
fourcc: input_buffer.slice(0, 4).toString(),
sample_rate: VBAN_SR_LIST[input_buffer[4] & VBAN_SR_MASK],
sub_protocol: VBAN_PROTOOLS[input_buffer[4] & VBAN_PROTOCOL_MASK],
samples: input_buffer[5],
channels: input_buffer[6],
format: VBAN_BIT_FMTS[input_buffer[7] & VBAN_BIT_RESOLUTION_MASK],
@TheStaticTurtle
TheStaticTurtle / gcal.py
Created February 8, 2022 23:44
Google calendar service
import datetime
import config
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/calendar']
@TheStaticTurtle
TheStaticTurtle / patch.diff
Created April 10, 2022 18:12
Filezilla patch to increase the maximum number of simultaneous connections to a maximum of 500
diff settings/optionspage_transfer.cpp settings/optionspage_transfer.cpp
52,53c52,54
< impl_->transfers_->SetRange(1, 10);
< impl_->transfers_->SetMaxLength(2);
---
> #warning Here
> impl_->transfers_->SetRange(1, 500);
> impl_->transfers_->SetMaxLength(3);
55c56
< inner->Add(new wxStaticText(box, nullID, _("(1-10)")), lay.valign);
@TheStaticTurtle
TheStaticTurtle / oled_spinner.c
Created June 15, 2022 07:01
Simple spinner with variable speed and size
//Call at least every 10ms
void oled_spinner() {
int x = 64, y = 35, r = 15;
static uint32_t millis = board_millis();
static float angle = 0;
if (board_millis() - millis < 10) return;
millis += 10;
@TheStaticTurtle
TheStaticTurtle / fu_cursor_install.bat
Created June 23, 2022 18:43
Change the windows 10 hand cursor
@echo off
set cursor-icon=AAACAAEAICAAAAkAAACoEAAAFgAAACg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