Skip to content

Instantly share code, notes, and snippets.

View FauxFaux's full-sized avatar

Chris West FauxFaux

View GitHub Profile
# Place a copy of this config to ~/.aerospace.toml
# After that, you can edit ~/.aerospace.toml to your liking
# You can use it to add commands that run after login to macOS user session.
# 'start-at-login' needs to be 'true' for 'after-login-command' to work
# Available commands: https://nikitabobko.github.io/AeroSpace/commands
after-login-command = []
# You can use it to add commands that run after AeroSpace startup.
# 'after-startup-command' is run after 'after-login-command'
use bitfield_struct::bitfield;
#[bitfield(u8)]
struct Status {
#[bits(4)]
tag: u8,
#[bits(4)]
channel: u8,
}
use anyhow::Result;
use std::net::SocketAddr;
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::net::{TcpListener, TcpStream};
async fn echo(mut socket: TcpStream, addr: SocketAddr) -> Result<()> {
println!("Incoming connection from: {}", addr);
let (read, mut write) = socket.split();
let mut read = BufReader::new(read);
write.write_all(b"Welcome!").await?;
[package]
name = "paper-events"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1"
itertools = "0.13"
bincode = { version = "2.0.0-rc.3", features = ["derive"] }
rand = "0.8"
async function throws() {
throw new Error('I threw!');
}
async function main() {
const result = throws();
console.log('seven');
await sleep(10);
console.log('nine');
await result;
@FauxFaux
FauxFaux / 1-demo.js
Created January 15, 2024 19:44
node-forge-fromDer
const forge = require("node-forge");
const badKeyValue = `MGsCAQEEIDrDtTbDnMKRwpvDpzkxLQpwO8O8w6zDq8OWwo
HCtcKedjrDgsOCMMOiw4rDqBsewpDCucKhRANCAAQ/c3zDq8K4wpnDvcO6N3nChsOUfnHD
k8OcQsORwqHCtMKFwrvCq08mw77CnsOHAl7DliQAwrsJX8OWYWzCn2lVw5DCg8OIeGfDpM
KxK8O4wr3Cn8OFdsO1HVhbw4xGWmbCpw==`;
const goodKeyValue = `MGsCAQEEIEjDv8KoIcO5wrrChl3DsUDDvXjDpMOYwrHDjMKKw
55pMT7CrMK8O8KQIsOTasK5SUZ7wqFEA0IABAQxUMOWennChGpcwoTDhsOvUzgeFsK3w7bCscK1wo
MDwrEuX8OPwrTCn8KUKcOiYcOtw6JRw7LDrSPCvMOtw4t/w4PDlcOQw5zDqiTCjDbCocKowpXCjMK
]i=:'467..114..',LF,'...*......',LF,'..35..633.',LF,'......#...'
]l=:;;. _1 (LF,i)
]n=:a.{~48+i.10
]b=:n,'.'
]q=:l e.n
]s=:((-.l e.b),0),.(5 $ 0)
]r=:a:-.~"1(1,"1-.q)<;._2 i.>:{:$q
]p=:,{{ (}.y),"0&.>"0(>{.y)}}"1 ((;/i.4),.r)
]w=:{{0>.(({.y)-0 1),y,(({:y)+0 1)}}&.>"0 p
]f=:{{0>.(y-"1 (1 0)),y,(y+"1 (1 0))}}&.>"0 w
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* butt::work */
undefined [16] butt::work(long **param_1,long param_2,uint *param_3)
{
long **pplVar1;
uint *puVar2;
long *plVar3;
@FauxFaux
FauxFaux / 1-README.md
Created October 6, 2022 09:09
Digoo temperature network

What's going on?

Some sensors collect data, transmit it to a radio, which is picked up by a reciever machine, which writes it into some storage for display.

Sensors

The sensors are called "Digoo DG-R8H R8H 433MHz Wireless Digital Hygrometer Thermometer Weather Station Outdoor Sensor for TH11300 TH8380 TH1981".

For these, I paid $3.82/item delivered in 2019. The price appears to have doubled in 2022.

const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const burn = work => {
let sum = 0;
for (let i = 0; i < work; ++i) {
let data = '';
for (let j = 0; j < 100_000; ++j) {
data += 'I love horses, best of all the animals.\n';
}
sum += data.length;
}