Skip to content

Instantly share code, notes, and snippets.

View bsodmike's full-sized avatar

Michael de Silva bsodmike

View GitHub Profile
@bsodmike
bsodmike / upload_revoked.sh
Last active July 9, 2024 19:00
Shell script (Fish) to upload all revoked GnuPG (GPG) keys to a keyserver
#!/opt/homebrew/bin/fish
#
# Upload all revoked GnuPG (GPG) keys to a keyserver.
# Usage: fish ./upload_revoked.sh
#
# Copyright (c) Michael de Silva
# Profile: https://desilva.io/about
# Email: mike.cto@securecloudsolutions.io // PGP: https://bit.ly/3W8u9R8
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of

Linux CPU Benchmark

4-threads for the Raspberry Pi 4 & 5

sysbench cpu --cpu-max-prime=20000 --threads=4 --validate run
@bsodmike
bsodmike / komodo-defi-challenge.md
Created May 26, 2024 15:09
Komodo DeFi Challenge feat-metrics

Your task is to extend the functionality of the Komodo DeFi Framework by adding a new node type called a Metrics Node. This will serve as a foundational piece for further development and integration within our framework.

Detailed Requirements:

Repository Setup:

Please fork the Komodo DeFi Framework repository and create a new branch off the dev branch to work on this task. Metrics Node Development:

@bsodmike
bsodmike / README.md
Last active April 22, 2024 15:34
STM32CubeIDE with Portenta H7

stm32h747xi_STM32CubeIDE_gist

Portenta H7

  • Bottom: Tx
  • Top: Rx

Traces

Tx from Arduino Portenta H7

@bsodmike
bsodmike / towards_impeccable_rust.md
Last active April 3, 2024 12:09
Towards Impeccable Rust by Jon Gjengset, session at Rust Nation UK (27th March 2024)

Towards Impeccable Rust

Testing

  • Miri
  • Test for error conditions

Embrace chaos (fuzzing)

  • Async/sync chaos Turmoil / shuttle
  • Value checks: quickcheck / proptest
  • Logic chaos: cargo-mutants
@bsodmike
bsodmike / crontab
Created March 17, 2024 07:41
pfSense crontab
# ┌───────────── Minute (0 - 59)
# │ ┌─────────── Hour (0 - 23)
# │ │ ┌───────── Date (1 - 31)
# │ │ │ ┌─────── Month (1 - 12)
# │ │ │ │ ┌───── Day of Week (0 - 7,0 Sunday,6 Saturday,7 Sunday)
# │ │ │ │ │
0 0 * * * /etc/rc.restart_webgui
@bsodmike
bsodmike / ssh_key_Ed25519.md
Created October 26, 2022 06:41
Create Ed25519 SSH key (ECDSA)
@bsodmike
bsodmike / handlers.rs
Last active October 21, 2024 14:19
Axum Redirect is syntactic sugar for a Response
async fn accept_form(Form(input): Form<Input>, state: Extension<AppState>) -> Response<Body> {
dbg!(&input);
match save_form(&input, &state).await {
Ok(_) => (),
Err(e) => tracing::error!("Failed: {:?}", e),
}
let mut response = Response::builder()
.status(StatusCode::SEE_OTHER)
---
criticalpatterns:
- 'pam_unix[\w\d\D]*failure'
- 'gkr-pam[\w\d\D]*invalid'
- 'USER_AUTH[\w\d\D]*pam_gnome_keyring[\w\d\D]*failed'
criticalexceptions:
- 'timestamp:".*",level:"(error|warn)"'
- '0 errors'
@bsodmike
bsodmike / atomics.rs
Created October 15, 2021 13:15
Crust of Rust: Atomics and Memory Ordering // My Notes
use std::cell::UnsafeCell;
use std::sync::atomic::{AtomicBool, Ordering};
const LOCKED: bool = true;
const UNLOCKED: bool = false;
pub struct Mutex<T> {
locked: AtomicBool,
v: UnsafeCell<T>,
}