Skip to content

Instantly share code, notes, and snippets.

View TobleMiner's full-sized avatar
🔥

Toble_Miner/tsys TobleMiner

🔥
  • Kiel
View GitHub Profile
@TobleMiner
TobleMiner / rwlock.c
Created October 14, 2024 13:55
FreeRTOS RW lock
#include "rwlock.h"
#define RW_LOCK_STATE_NOT_WRITING (1UL << 0)
void rw_lock_init(rw_lock_t *rwlock) {
rwlock->write_lock = xSemaphoreCreateBinaryStatic(&rwlock->write_lock_buffer);
xSemaphoreGive(rwlock->write_lock);
rwlock->reader_count_lock = xSemaphoreCreateMutexStatic(&rwlock->read_count_lock_buffer);
rwlock->reader_count = 0;
rwlock->state = xEventGroupCreateStatic(&rwlock->state_buffer);
#!/usr/bin/env python3
import sys
from OCC.Core.STEPControl import STEPControl_Reader
from OCC.Core.IFSelect import IFSelect_RetDone, IFSelect_ItemsByEntity
from OCC.Core import Tesselator
input_file = sys.argv[1]
output_file = sys.argv[2]
ACTION=="bind", SUBSYSTEMS=="usb", RUN="/usr/local/sbin/libvirt-hotplug.py usb"
@TobleMiner
TobleMiner / Makefile
Created March 5, 2022 21:06
Simple Linux kernel module to test device vs normal memory PCI BAR accesses
obj-m += bar-write-test.o
@TobleMiner
TobleMiner / arc_to_trace.py
Created April 30, 2020 23:37
pcbnew plugin to convert graphical arc to traces
#!/usr/bin/env python
import pcbnew
import os
import math
RESOLUTION = 1
EPSILON = 1e-4
def arc_to_trace(board, arc):
@TobleMiner
TobleMiner / cmdline
Last active March 30, 2020 15:29
linux2boot, a kexec based linux boot manager. Run as login through inittab, enable respawn
console=ttyS2,1500000 root=/dev/mmcblk1p1 rw rootwait video=eDP-1:1920x1080@60 vga=current initcall_debug maxcpus=2
@TobleMiner
TobleMiner / .config
Created March 19, 2020 01:09
Config for tiny kernel \w panfrost on the Pinebook Pro
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 5.6.0-rc6 Kernel Configuration
#
#
# Compiler: aarch64-linux-gnu-gcc (Linaro GCC 7.4-2019.02) 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4]
#
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=70401
@TobleMiner
TobleMiner / cw201x_battery.c
Created March 10, 2020 14:18
CellWise Android GPL driver example
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/workqueue.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/delay.h>
@TobleMiner
TobleMiner / gist:3f6738d51a4bdc52ea2b2033d73973e3
Created February 26, 2020 21:51
conntrack timeout settings for connlimit on busy connections
net.netfilter.nf_conntrack_tcp_timeout_close = 10
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 30
net.netfilter.nf_conntrack_tcp_timeout_established = 432000
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 30
net.netfilter.nf_conntrack_tcp_timeout_last_ack = 30
net.netfilter.nf_conntrack_tcp_timeout_max_retrans = 30
net.netfilter.nf_conntrack_tcp_timeout_syn_recv = 30
net.netfilter.nf_conntrack_tcp_timeout_syn_sent = 30
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 30
net.netfilter.nf_conntrack_tcp_timeout_unacknowledged = 30
@TobleMiner
TobleMiner / mkflashimage.sh
Last active February 22, 2020 02:47
Simple script to create a full flash image from a mtdparts cmdline partition specification
#!/usr/bin/env sh
# The MIT License
#
# Copyright (c) 2020 Tobias Schramm
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell