Skip to content

Instantly share code, notes, and snippets.

View bsodmike's full-sized avatar

Michael de Silva bsodmike

View GitHub Profile
@bsodmike
bsodmike / gpg_file_share_workflow.md
Created June 13, 2026 12:49
GPG / OpenPGP File Encryption Workflow (ASCII Armored)

GPG / OpenPGP File Encryption Workflow (ASCII Armored)

Recommended Process for Exchanging Confidential Documents

  1. Verify the recipient’s identity using a trusted, independent channel (not email alone).
  2. Obtain the recipient’s public key from a trusted source (direct transfer, verified website, or keyserver).
  3. Import the recipient’s public key into your local GPG keyring.
  4. Verify the recipient’s key fingerprint against a value confirmed via a separate communication channel.
  5. Decide whether to mark the key as trusted in your local trust database (this affects GPG behavior, not cryptographic security).
  6. Encrypt the file for the recipient and sign it with your private key using ASCII-armored output.
If the `InternalAPI` should not be part of the `ItemsCollection`, we can decouple it by using **dependency injection** or **traits**. This way, the `ItemsCollection` can interact with the `InternalAPI` without directly owning or knowing about its implementation. This approach aligns with the **Dependency Inversion Principle** and makes the code more modular and testable.
Here’s how you can refactor the code to achieve this:
---
### Refactored Code
```rust
use reqwest::blocking::Client;
@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 October 12, 2025 14:56
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 June 26, 2025 11:15
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)