Skip to content

Instantly share code, notes, and snippets.

View bozdoz's full-sized avatar
☠️
I may be dead

bozdoz bozdoz

☠️
I may be dead
View GitHub Profile
@bozdoz
bozdoz / getPassword.js
Created June 4, 2024 00:18
Get a password from stdin
const readline = require("node:readline");
const { Writable } = require("node:stream");
const getPassword = (user) =>
new Promise((resolve) => {
const mutableStdout = new Writable({
write: function (chunk, encoding, callback) {
if (!this.muted) process.stdout.write(chunk, encoding);
callback();
},
@bozdoz
bozdoz / main.rs
Last active December 4, 2024 17:08
AOC 2024 Day 4 in rust
#![allow(unused)]
fn main() {
let example = "
MMMSXXMASM
MSAMXMSMSA
AMXSXMAAMM
MSAMASMSMX
XMASAMXAMM
XXAMMXXAMA
@bozdoz
bozdoz / main.rs
Created December 11, 2024 20:52
AOC 2024 Day 11
fn main() {
let s = "125 17";
let mut data: Vec<_> = s.split(" ").map(|x| { x.parse::<usize>().unwrap() }).collect();
let mut len = data.len();
// println!("{:?}", data);
for _ in (0..).take(75) {
// println!("len: {len}");
@bozdoz
bozdoz / README.md
Last active December 26, 2024 07:09
Simple Example of how Deno could be calling NPM scripts

Important

Run with deno run --allow-run=deno main.ts (this allows us to run deno instead of node in scripts, but prevents any other nefarious scripts)

With NPM

npm run start

> [email protected] start
> node evil.js
@bozdoz
bozdoz / main.rs
Created December 30, 2024 15:36
aoc 23
#![allow(unused)]
use std::collections::{ HashMap, HashSet };
fn main() {
let networks = "kh-tc
qp-kh
de-cg
ka-co
yn-aq
@bozdoz
bozdoz / main.rs
Created December 30, 2024 17:34
aoc 24 1/2
#![allow(unused)]
use std::collections::{ HashMap, HashSet };
#[derive(Debug)]
enum Op {
AND,
XOR,
OR
}