Skip to content

Instantly share code, notes, and snippets.

View kurisuke's full-sized avatar

Peter Helbing kurisuke

View GitHub Profile
@kurisuke
kurisuke / main.rs
Created February 7, 2026 14:18
openssl-keyusage-test
/*
add to Cargo.toml (if missing):
[dependencies]
foreign-types-shared = "0.1.1"
openssl = "0.10.75"
openssl-sys = "0.9.111"
Test with e.g.:
$ openssl req -new -x509 -key root.key -out root.pem -days 365 -subj "/CN=Test" -config openssl.cnf -extensions add_key_usage
@kurisuke
kurisuke / main.rs
Created May 18, 2024 06:12
MPSC with trait object
use std::time::Duration;
trait UpdateSource: Send {
fn info(&self) -> String;
}
struct OnlineUpdate {
version: String,
url: String,
}
@kurisuke
kurisuke / main.rs
Created May 16, 2024 08:26
Bandwidth throttle / download rate limit with reqwest
use std::time::Duration;
use futures::StreamExt;
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let args: Vec<_> = std::env::args().collect();
let url = &args[1];
let target_rate = args.get(2).map(|a| a.parse::<f64>().unwrap());
@kurisuke
kurisuke / add_cover_art.py
Created June 9, 2022 19:14
Add cover art to audio files from MusicBrainz DB
#!/usr/bin/env python3
import base64
import os.path
import musicbrainzngs
import mutagen.flac
import mutagen.id3
import mutagen.mp3
import mutagen.oggvorbis