Skip to content

Instantly share code, notes, and snippets.

@cyber-murmel
cyber-murmel / bmp_rts_dtr.patch
Created January 28, 2022 20:26
Patch to add RTS on PB8 and DTR on PB9 to the Black Magic Probe UART
diff --git a/src/platforms/common/cdcacm.c b/src/platforms/common/cdcacm.c
index 399dd3d..d56d10e 100644
--- a/src/platforms/common/cdcacm.c
+++ b/src/platforms/common/cdcacm.c
@@ -451,12 +451,17 @@ static enum usbd_request_return_codes cdcacm_control_request(usbd_device *dev,
case USB_CDC_REQ_SET_CONTROL_LINE_STATE:
cdcacm_set_modem_state(dev, req->wIndex, true, true);
/* Ignore if not for GDB interface */
- if(req->wIndex != GDB_IF_NO)
+ switch(req->wIndex) {
@cyber-murmel
cyber-murmel / satisfactory.nix
Last active May 11, 2023 08:01
Dedicated Satisfactory 5 Server on NixOS
{config, pkgs, lib, ...}: {
users.users.satisfactory = {
home = "/var/lib/satisfactory";
createHome = true;
};
nixpkgs.config.allowUnfree = true;
systemd.services.satisfactory = {
wantedBy = [ "multi-user.target" ];
@cyber-murmel
cyber-murmel / openwrt-espressobin_ultra.md
Last active January 28, 2024 05:43
OpenWRT on ESPRESSObin Ultra

OpenWRT supports the ESPRESSObin Ultra since 2020. Official builds are available.

In thins gist I want to explain how to install the image onto the board via a USB thumb drive.

All you need

  • ESPRESSObin Ultra
  • 12V 2A DC or PoE power supply
  • USB A to USB Micro-B cable
  • wired internet connection
@cyber-murmel
cyber-murmel / hamming.c
Last active July 5, 2023 06:06
Hamming 63 57 in C
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h> // compile with -lm
#define MASK(LEN) ((1<<LEN)-1)
#define GET_BITS(VAR, POS, NUM) ((VAR>>POS) & MASK(NUM))
#define GET_BIT(VAR, POS) GET_BITS(VAR, POS, 1)
@cyber-murmel
cyber-murmel / EE & CE Resources.md
Last active May 16, 2022 09:29
a compiliation of useful links on the topic of electrical and computer engineering

EE & CE Resources

:::info This is a compiliation of useful links on the topic of electrical and computer engineering. This isnt' a comprehensive list. Feel free to add links to resources you found useful yourself.

:::

:::info

@cyber-murmel
cyber-murmel / shell.nix
Created May 31, 2021 20:58 — forked from Mic92/shell.nix
Nix FHS env for OpenWrt
{ pkgs ? import <nixpkgs> {} }:
let
fixWrapper = pkgs.runCommand "fix-wrapper" {} ''
mkdir -p $out/bin
for i in ${pkgs.gcc.cc}/bin/*-gnu-gcc*; do
ln -s ${pkgs.gcc}/bin/gcc $out/bin/$(basename "$i")
done
for i in ${pkgs.gcc.cc}/bin/*-gnu-{g++,c++}*; do
ln -s ${pkgs.gcc}/bin/g++ $out/bin/$(basename "$i")
@cyber-murmel
cyber-murmel / file_check.md
Created May 17, 2020 14:28
recursive file integrity checking using openssl dgst

Recursive File Integrity Checking using openssl dgst

Checksumming

Use find to iterate trought all subdirectories of the given path (./). openssl dgst -sha256 each file in each directory and add the output to the SHA256 file in the corresponding directory.

find ./ -type d -exec sh -c 'cd "{}"; find ./ -maxdepth 1 -type f -not -name SHA256 -exec openssl dgst -sha256 \{\} + | sort -u | tee SHA256' \;

Checking

@cyber-murmel
cyber-murmel / datamatrix_capacity.py
Created February 17, 2020 14:24
DataMatrix Capacity
# each datamatrix size can fit as many numbers as according to the following dict
# a non-number letter needs double as much space as a number
# an emoji need 16x as much space as a number 😂
size_capacity_maps = {
'square': {
'10x10': 6, '12x12': 10, '14x14': 16, '16x16': 24,
'18x18': 36, '20x20': 44, '22x22': 60, '24x24': 72,
'26x26': 88, '32x32': 124, '36x36': 172, '40x40': 228,
'44x44': 288, '48x48': 348, '52x52': 408, '64x64': 560,
'72x72': 736, '80x80': 912, '88x88': 1152, '96x96': 1392,
@cyber-murmel
cyber-murmel / ice40.py
Created February 13, 2020 11:42
ice40.py
# -*- coding: utf-8 -*-
# Copyright 2020 by https://badge.team/
# This file is released under the "CC0 1.0 Universal" license.
# https://creativecommons.org/publicdomain/zero/1.0/legalcode
from machine import Pin, SPI
# Pins
pin_reset = Pin(16, Pin.OUT)
@cyber-murmel
cyber-murmel / ice40web.py
Created February 13, 2020 11:41
ice40web.py
# -*- coding: utf-8 -*-
# Copyright 2020 by https://badge.team/
# This file is released under the "CC0 1.0 Universal" license.
# https://creativecommons.org/publicdomain/zero/1.0/legalcode
from machine import Pin, SPI
import wifi, urequests, sys
# Pins