Skip to content

Instantly share code, notes, and snippets.

View bsodmike's full-sized avatar

Michael de Silva bsodmike

View GitHub Profile
@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 / gist:1369419
Created November 16, 2011 06:25
Subdomain Routing with Rails 3.1

Implement Routing for Subdomains

Rails 3.0 introduced support for routing constrained by subdomains.

A subdomain can be specified explicitly, like this:

match '/' => 'home#index', :constraints => { :subdomain => 'www' } 
@bsodmike
bsodmike / edgemax-ad-blocker-dnsmasq.md
Last active September 4, 2023 18:28
HOWTO Ubiquity EdgeMAX Ad Blocking Content Filtering using EdgeRouter

Ubiquity EdgeMAX Ad Blocking Content Filtering using EdgeRouter

This is based on a guide on the Ubnt forums.

Log into your Edgerouter and run the following - sudo -i && vi /config/user-data/update-adblock-dnsmasq.sh This will switch you to the root user and open up vi.

#!/bin/bash
@bsodmike
bsodmike / edgerouter-VPN-config.txt
Created August 13, 2017 10:29
EdgeRouter OpenVPN to Private Internet Access!
# Reference: https://www.youtube.com/watch?v=B9dXiKhDVl0
## Remember to tailor this to your network! ##
set interfaces openvpn vtun0 config-file /config/auth/midwest.ovpn
set interfaces openvpn vtun0 description 'Private Internet Access'
set interfaces openvpn vtun0 enable
set service nat rule 5000 description PIA
set service nat rule 5000 log disable
set service nat rule 5000 outbound-interface vtun0
@bsodmike
bsodmike / edgerouter-network-isolation.txt
Last active April 16, 2023 05:32
EdgeRouter IoT/Guest Network Isolation
# Reference: https://www.youtube.com/watch?v=baj3747yfos
configure
set firewall group network-group PROTECT_NETWORKS
set firewall group network-group PROTECT_NETWORKS description "Protected Networks"
set firewall group network-group PROTECT_NETWORKS network 10.0.0.0/16
set firewall name BLOCK_IN
set firewall name BLOCK_IN default-action accept
set firewall name BLOCK_IN rule 10 action accept
set firewall name BLOCK_IN rule 10 description "Accept Established/Related"
@bsodmike
bsodmike / README.md
Last active March 13, 2023 05:04
OC Nvidia GTX1070s in Ubuntu 16.04LTS for Ethereum mining

Following mining and findings performed on EVGA GeForce GTX 1070 SC GAMING Black Edition Graphics Card cards.

First run nvidia-xconfig --enable-all-gpus then set about editing the xorg.conf file to correctly set the Coolbits option.

# /etc/X11/xorg.conf
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
@bsodmike
bsodmike / handlers.rs
Last active March 5, 2023 16:06
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)
@bsodmike
bsodmike / bootable_windows_usb.md
Created August 14, 2016 16:02
Creating a bootable Windows 10 USB drive from ISO in Mac OS.

Command Line approach.

The ‘r’ prefixing the identifier signifies the raw data under the visible file system, which is necessary to make the output volume bootable. It’s also faster because it’s block aligned IO. Basically, rdisk goes directly to the disk, disk goes through the fileystem.

"Since any /dev entry can be treated as a raw disk image, it is worth noting which devices can be accessed when and how. /dev/rdisk nodes are character-special devices, but are “raw” in the BSD sense and force block-aligned I/O. They are closer to the physical disk than the buffer cache. /dev/disk nodes, on the other hand, are buffered block-special devices and are used primarily by the kernel’s filesystem code.

It is not possible to read from a /dev/disk node while a filesystem is mounted from it, but anyone with read access to the appropriate /dev/rdisk node can use hdiutil verbs such as fsid or pmap with it.Beware that information read from a raw device while a filesystem is mounted may not be consistent be