Skip to content

Instantly share code, notes, and snippets.

IDEs recommandés pour le dev C

  • CLion (gratuit avec compte étudiant JetBrains)
  • Visual Studio (pour le dev sous Windows)

VS Code peut être utilisé mais je ne le recommande pas. Le tooling est assez mauvais.

OS recommandés

Sous Linux et Mac c'est relativement facile. Sous Windows, avec WSL, c'est de même. En Windows natif c'est beaucoup moins agréable.

@zdimension
zdimension / walks.py
Last active November 9, 2024 13:49
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]