This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Days.D16 where | |
import Numeric ( showIntAtBase ) | |
import Text.Megaparsec hiding ( parse ) | |
import Text.Megaparsec.Char | |
import Text.Printf ( printf ) | |
import Utils hiding ( count ) | |
data Packet = Packet Int Int PacketObj deriving Show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import reduce | |
import z3 | |
file = "../input/d24.txt" | |
with open(file) as f: | |
instrs = [l.strip().split() for l in f.read().splitlines()] | |
n = 14 # Number of digits. | |
block = 18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import z3 | |
# Initialisation procedure. | |
encoded = '5a4b3c2d5a4b4c1d2a1e3a3b4c1d2a1e1f2a3b3c1g1d3e5f1b2c2g1d1f2e4f6g1d7f3h3g1d4f6h3g1d2f1i4j1h2k2l1m1d3i2j5k2l2m2i3j4k3l2m2i3j4k3l2m1i5j2k2n2l2m1i4j5n4l' | |
chars = '' | |
for i in range(len(encoded) // 2): | |
skip, char = encoded[2*i:2*i+2] | |
chars += int(skip) * char | |
assert len(chars) == 0xc4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#ifdef __SSSE3__ | |
#include <x86intrin.h> | |
#endif | |
#if defined(__ARM_NEON) || defined(__aarch64__) | |
#include <arm_neon.h> | |
#endif | |
#ifdef __linux__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use regex::Regex; | |
use std::collections::{HashSet, LinkedList}; | |
use std::fs; | |
type Set = HashSet<(cube_t, cube_t, cube_t)>; | |
#[allow(non_camel_case_types)] | |
type cube_t = i64; | |
type Cuboid = ((cube_t, cube_t), (cube_t, cube_t), (cube_t, cube_t)); | |
struct Command(bool, Cuboid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Additive Synthesis Demo | |
# by @TrebledJ | |
import matplotlib.pyplot as plt | |
import numpy as np | |
t = np.linspace(0, 1, 44100) | |
t = t[:800] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wavetable Synthesis Demo | |
# by @TrebledJ | |
from matplotlib.patches import ConnectionPatch | |
import matplotlib.ticker as mticker | |
import matplotlib.pyplot as plt | |
from matplotlib.animation import FuncAnimation | |
import numpy as np | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// main.c | |
#include "stm32f4xx_hal.h" | |
#include <math.h> | |
#include <stdint.h> | |
DAC_HandleTypeDef hdac; | |
DMA_HandleTypeDef hdma_dac1; | |
DMA_HandleTypeDef hdma_dac2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DownUnderCTF 2023 – Wrong Signal | |
# Solve Script by TrebledJ | |
# WriteUp: https://trebledj.github.io/posts/ductf-2023-wrong-signal/ | |
import z3 | |
# Func to extract crumbs from bytes. | |
crumbs = lambda bs: [(b >> (2 * i)) & 0b11 for b in bs for i in range(4)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HITCON 2023 – The Blade | |
# Solve Script by TrebledJ | |
# WriteUp: https://trebledj.github.io/posts/hitcon-2023-the-blade | |
import string | |
############### | |
### Part 1. ### | |
############### |
OlderNewer