Skip to content

Instantly share code, notes, and snippets.

View Chaz6's full-sized avatar

Chris Hills Chaz6

View GitHub Profile
@Chaz6
Chaz6 / Cargo.toml
Created June 20, 2024 18:04
SHAllenge in Rust
[package]
name = "shallenge"
version = "0.1.0"
edition = "2021"
[dependencies]
sha2 = "0.11.0-pre.3"
@Chaz6
Chaz6 / daytime_server.rs
Created July 3, 2024 14:05
daytime server in rust
use chrono::Local;
use std::io::Write;
use std::net::{TcpListener, TcpStream};
fn handle_client(mut stream: TcpStream) {
let dt = Local::now().to_utc();
stream.write_all(dt.to_string().as_bytes()).unwrap();
stream.shutdown(std::net::Shutdown::Both).unwrap();
}
@Chaz6
Chaz6 / make-datamatrix-barcode-from-uuid.py
Last active October 17, 2024 16:03
Generate an svg data matrix barcode for a uuid
#!/usr/bin/env python3
import uuid as _uuid
import argparse
from itertools import batched
from pylibdmtx.pylibdmtx import encode
size = 18
size_with_margin = size + 4
encoding = "Base256"
@Chaz6
Chaz6 / make-datamatrix-shortuuid-label-v2.py
Created January 17, 2025 09:25
make-datamatrix-shortuuid-label-v2.py
#!/usr/bin/env python3
import argparse
import shortuuid
from itertools import batched
from pylibdmtx.pylibdmtx import encode
padding = 5
output_svg_width = 25
output_svg_height = 25