Skip to content

Instantly share code, notes, and snippets.

View zdimension's full-sized avatar

Tom Niget zdimension

View GitHub Profile
@zdimension
zdimension / walks.py
Last active July 4, 2024 05:12
wrote this code quickly, didn't spend any time making it look good, a third is probably copilot
import json
import sys
from datetime import datetime, timedelta
def parse(d):
return datetime.fromisoformat(d)
def proc(d):
s, e = map(parse, d)
return e - s
use rayon::prelude::*;
use sha256::digest;
fn src(n: usize) -> String {
format!("zdimension/5900X/60MHs/{}", n)
}
fn hash(n: usize) -> String {
digest(src(n))
}
@zdimension
zdimension / client.c
Last active December 24, 2023 00:52
libserver / libclient (softsec)
#include <netinet/ip.h>
#include <sys/socket.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdio.h>
const char leng[] = "1025";
/* Sends a *null-terminated* string to the specified port.
@zdimension
zdimension / test_alu.txt
Last active January 19, 2024 10:34
Tests provenant originellement de https://github.com/FlorianLatapie/PNS-SI3-S5_P-ARM_Groupe_B/tree/main/tests, corrigés et mis à jour (01/2024)
A[32] B[32] Shift[5] CarryIn[1] Codop[4] S[32] Flags[4]
# NZCV
# A B Shift CarryIn Codop S Flags
# AND
11111111111111111111111111111111 11111111111111111111111111111111 00000 0 0000 11111111111111111111111111111111 1000
11111111111111111111111111111111 11111111111111111111111111111111 00001 0 0000 11111111111111111111111111111111 1000
11111111111111111111111111111111 11111111111111111111111111111111 01111 0 0000 11111111111111111111111111111111 1000
11111111111111111111111111111111 11111111111111111111111111111111 11111 0 0000 11111111111111111111111111111111 1000
11111111111111111111111111111111 11111111111111111111111111111111 00000 1 0000 11111111111111111111111111111111 1000
A[32] B[32] Shift[5] CarryIn[1] Codop[4] S[32] Flags[4]
# NZCV
# A B Shift CarryIn Codop S Flags
# AND
11111111111111111111111111111111 11111111111111111111111111111111 00000 0 0000 11111111111111111111111111111111 1000
11111111111111111111111111111111 11111111111111111111111111111111 00001 0 0000 11111111111111111111111111111111 1000
11111111111111111111111111111111 11111111111111111111111111111111 01111 0 0000 11111111111111111111111111111111 1000
11111111111111111111111111111111 11111111111111111111111111111111 11111 0 0000 11111111111111111111111111111111 1000
11111111111111111111111111111111 11111111111111111111111111111111 00000 1 0000 11111111111111111111111111111111 1000
identification division.
program-id. aoc3.
author. zdimension
environment division.
input-output section.
file-control.
*> expects input from stdin
select sysin assign to keyboard organization line sequential.
;==============================================================================
;
; Fichier d'initialisation Emacs
;
; Creation date: Quelque part en 1984 !!!
; Last file update: 10-Sep-2001 21:36 (eg)
;
;==============================================================================
;==============================================================================
@zdimension
zdimension / bruteforce.rs
Last active August 24, 2023 16:02
Pycto color spectrum puzzle solver
use aes::cipher::{block_padding::Pkcs7, BlockDecryptMut, KeyIvInit};
use itertools::Itertools;
use pbkdf2::pbkdf2_hmac_array;
use rayon::iter::ParallelBridge;
use rayon::iter::ParallelIterator;
use std::process::exit;
use chrono::Local;
type Aes128CbcDec = cbc::Decryptor<aes::Aes128>;
use sha1::Sha1;
from nicegui import ui, app
import alsaaudio as audio
cards = audio.cards()
card = cards[2]
assert card == "ICUSBAUDIO7D"
mixer = audio.Mixer("Speaker", cardindex=2)
def get_volume():
return muted_volume or mixer.getvolume()[0]
@zdimension
zdimension / basic.out
Created March 31, 2023 22:17
list function calls in a C file and look up in man
isatty (3) - test whether a file descriptor refers to a terminal
open (2) - open and possibly create a file
dup2 (2) - duplicate a file descriptor
close (2) - close a file descriptor
sigaction (2) - examine and change a signal action
execvp (3) - execute a file