Skip to content

Instantly share code, notes, and snippets.

@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}')