Skip to content

Instantly share code, notes, and snippets.

View unfo's full-sized avatar

Jan Wikholm unfo

View GitHub Profile
@unfo
unfo / brute-force-counter-main.rs
Created January 9, 2023 12:54
brute-force-counter
use counter::Counter;
use itertools::Itertools;
fn main() {
let pw = String::from("lW2jYRI02ZKDBb9VtQBU1f6eDRo6WEj9");
let lower = (b'a' ..= b'z').map(char::from).collect::<Vec<_>>();
let upper = (b'A' ..= b'Z').map(char::from).collect::<Vec<_>>();
let num = (b'0' ..= b'9').map(char::from).collect::<Vec<_>>();
let mut pw_space = lower.clone();
pw_space.extend(upper);
@unfo
unfo / gamma-encoder.rs
Created January 20, 2023 15:36
Elias Gamma Encoding in Rust
// Wikipedia: https://en.wikipedia.org/wiki/Elias_gamma_coding
use std::vec;
use std::env;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
panic!("Please provide gamma-encoded binary string as input");
}
# ChatGPT prompt:
# i would like to create a code that would generate all possible combinations of CVSS scores and
# output the configuration + calculated score in CVS format to STDOUT.
# could you help me generate that code in python?
# Output:
import csv
import sys
from itertools import product
from cvss import CVSS3
@unfo
unfo / analyze.py
Last active August 3, 2023 12:35
Analyzing entropy visually in jupyter notebook
# ChatGPT: i have a binary file called "output.bin".
# i want to read it with python as a stream of integers triplets
# that map as coordinates in a 3d space and then plot those data points with mathplotlib.
# all of this is happening in jupyter notebook.
# + some additional small tweaking
# Output:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
[package]
name = "minimum_sample_size"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "4.4.14", features = ["derive"] }
num-integer = "0.1.45"
@unfo
unfo / 0-README.md
Last active February 6, 2025 12:03
Disobey calendar json to ICS and Markdown output.

Disobey events to iCal calendar (.ics)

Official program here: https://disobey.fi/2025/program

This script converts the Disobey schedule from https://disobey.fi/2025/inc/schedule.json to .ics events.

It also, as a bonus, prints out the schedule in Markdown so that you can take that as the basis for your .md notes in Obsidian or notetaking app of choice.

To save you some time, I also include the output files below for download.

import csv
import sys
from itertools import product
from cvss import CVSS3
# Check if a CVSS score was provided as a command-line argument
if len(sys.argv) != 2:
print(f'Usage: {sys.argv[0]} <cvss_score>')
sys.exit(1)