Skip to content

Instantly share code, notes, and snippets.

View dehanjl's full-sized avatar

Dehan Jaco Lamprecht dehanjl

View GitHub Profile
@dehanjl
dehanjl / envtest.rs
Created March 8, 2023 19:23
Rust not finding environment variable defined in .zshrc
use std::env;
fn main() {
let var = env::var("SOME_VAR");
println!("SOME_VAR: {var:?}");
}
// When SOME_VAR is define in .zshrc:
/*
~/Developer/envtest
@dehanjl
dehanjl / HM-10_Commander.ino
Created September 22, 2020 13:50
Change AT settings of the HM-10
// Dehan Lamprecht, 2020
// Allows changing the settings of the HM-10 (or MLT-BT05) module
// Adapted from http://www.martyncurrey.com/hm-10-bluetooth-4ble-modules/
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(2, 3); // RX | TX
char c=' ';
boolean NL = true;
@dehanjl
dehanjl / HC-05_Commander.ino
Created September 22, 2020 13:46
Change AT settings of the HC-05
// Dehan Lamprecht, 2020
// Allows changing the settings of the HC-05 module
// Adapted from https://www.instructables.com/id/Program-an-Arduino-Wireless-Over-Bluetooth/
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(2, 3); // RX | TX
void setup() {
// Set PIN 9 to HIGH for getting HC-05 into AT mode
// Check Step 4 of link for instructions
@dehanjl
dehanjl / cpp.json
Last active September 6, 2018 12:45
VS Code Code Snippets and Setup Files
"Header Guard": {
"prefix": "#ifndef",
"body": [
"#ifndef $0${2:MACRO} // header guard",
"#define ${2:MACRO}",
"",
"",
"",
"#endif",
],
@dehanjl
dehanjl / F1Ct-3.py
Created January 31, 2017 13:00
null created by dehan-jl - https://repl.it/F1Ct/3
def recsort(i, ll, list0):
if len(list0) == 0:
return list0
list2[i] = min(list0)
list2[ll-i-1] = max(list0)
del list0[list0.index(min(list0))]
del list0[list0.index(max(list0))]
print(list0)
print(list2)
i += 1