Skip to content

Instantly share code, notes, and snippets.

@dzid26
dzid26 / torque_lat_accel.py
Last active June 17, 2025 16:09
Move event filters. Added curve fitting.
#!/usr/bin/env python3
import argparse
import os
import pickle
from aiohttp import Fingerprint
import numpy as np
import matplotlib.pyplot as plt
from functools import partial
from tqdm import tqdm
from typing import NamedTuple
#To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
@dzid26
dzid26 / exportProject.FCMacro
Last active June 20, 2025 13:02
remove trailing space
# Copyright 2016, Jon Nordby <[email protected]>. Licensed LGPLv2+ & MIT
# [email protected]: ChatGPT + Deepseek R1
"""
exportProject:
Exports all files in document which have names like "mypart [dxf]" or "otherpart[stl,step]"
to individual files in an export directory. Default prefix: 'export/$project-'.
Prints clean results to console only when exports occur.
"""
@dzid26
dzid26 / movingAverage.c
Created June 6, 2023 22:32
32bit movingAverage with 16bit buffer + offsets - for slowly moving signals
#define AVG_WINDOW 16U
static int32_t errMovingAverage(int32_t val) {
const uint8_t window_n = AVG_WINDOW;
static int16_t ringbuffer[AVG_WINDOW-1U];
static int32_t offset = 0;
static int32_t old_offset = 0;
static uint8_t ringbuffer_idx = window_n-1U;
static int32_t avg=0;
@dzid26
dzid26 / bitcoin_exponent_vs_linear.py
Last active January 2, 2023 23:02
Compare bitcoin supply exponentially decaying rewards with a hypothetical linear one. Which one decays faster and when?
# Compare bitcoin supply exponentially decaying rewards with a hypothetical linear one
# Linear reward decay coefficient has been calibrated to produce 21 million bitcoins after 32 adjustments as in normal bitcoin
#%% parameters
reward_adjustments = 32
blocks_between_adjustment = 210000
minutes_every_block = 10
# metrics
years_per_adjustment = round(blocks_between_adjustment * minutes_every_block / 60 / 24 / 365) # ~4 years
all_rewarded_years = years_per_adjustment * reward_adjustments # ~128 years
@dzid26
dzid26 / octave-gui.ini
Last active December 10, 2021 15:56
Octave Dark-Mode Windows
[General]
customFileEditor=notepad++ -n%l %f
monospace_font=Courier New
language=SYSTEM
style=default
toolbar_icon_size=0
use_system_icon_theme=true
use_native_file_dialogs=false
cursor_blinking=true
prompt_to_exit=false
@dzid26
dzid26 / update-gcc-clang-12-ubuntu-16.04-xenial.sh
Last active August 19, 2021 01:37 — forked from orenyomtov/update-gcc-clang-8-ubuntu-16.04-xenial.sh
Update clang to 12 and gcc to 8 and qt5.11.1 on Ubuntu xenial 16.04
if [ ! -f /usr/bin/gcc-8 ]; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-8 g++-8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 1000
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 1000
fi
if [ ! -f /usr/bin/clang-12 ]; then

Keybase proof

I hereby claim:

  • I am dzid26 on github.
  • I am dzid_ (https://keybase.io/dzid_) on keybase.
  • I have a public key ASAsdXcSf4rtGsmPpTSxeotPUTLBDpKQrZntD1J3eJt58wo

To claim this, I am signing this object:

@dzid26
dzid26 / install_deletion_job.sh
Created September 12, 2018 01:47 — forked from SippieCup/install_deletion_job.sh
Installer for script & cron job that automatically deletes older drives when free space goes under 10GB.
#!/bin/sh
echo "Creating /data/cleardata/cleardata.sh"
# Create deletion script
mkdir /data/cleardata
echo "#!/bin/sh
# get the available space left on the device
size=\$(df -k /storage/emulated/0/Android/data | tail -1 | awk '{print \$4}')