Skip to content

Instantly share code, notes, and snippets.

View zwade's full-sized avatar
💻
Probably CTFing

Zach Wade zwade

💻
Probably CTFing
View GitHub Profile
@zwade
zwade / README.md
Last active February 10, 2023 18:21
Code Review Rangiri

Code Review Rangiri

Setup

This is part of a broader set of tools used to make it easier to split one large change into many.

Move these two commands into a user-writable bin folder (I personally user ~/bin, but you may prefer /usr/local/bin or similar).

Usage

@zwade
zwade / fsm.ts
Created September 19, 2022 05:13
A sample FSM description in TypeScript
// StateMachine Types and Helpers
const opaquenessProof = Symbol.for("Opaqueness Proof");
type Args<T> = T extends (...args: infer Args) => any ? Args : never;
type OpaqueResult = {
[opaquenessProof]: true;
nextState: string;
args: any[];
@zwade
zwade / readme.txt
Created November 7, 2021 02:27
Panopticon (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@zwade
zwade / disasm.py
Last active May 3, 2021 00:09
Tiamat Disassembler
from typing import Dict, List, Optional
from capstone import *
import sys
from capstone.ppc_const import PPC_INS_XVABSSP
sparc_little = Cs(CS_ARCH_SPARC, CS_MODE_V9 | CS_MODE_BIG_ENDIAN)
sparc_big = Cs(CS_ARCH_SPARC, CS_MODE_V9 | CS_MODE_BIG_ENDIAN)
riscv_little = Cs(CS_ARCH_RISCV, CS_MODE_RISCV32)
riscv_big = Cs(CS_ARCH_RISCV, CS_MODE_RISCV32)
#ifdef GL_ES
precision highp float;
precision highp int;
#endif
uniform float time;
uniform float dt;
uniform vec2 resolution;
uniform ivec4 loopback[250];
@zwade
zwade / train.py
Created March 22, 2021 18:17
Comet ML + dataTap
from comet_ml import Experiment
import torch
import torchvision
import torchvision.transforms as T
from datatap import Api
from datatap.torch import create_dataloader, torch_to_image_annotation
from datatap.utils.print_helpers import pprint
from datatap.metrics import ConfusionMatrix, PrecisionRecallCurve
from datatap.comet import init_experiment, log_validation_proposals
@zwade
zwade / acid-object.ts
Created September 5, 2020 16:46
Crazy Proxy-based Transactional Object
type Base<T> =
T extends (infer V)[] ? { push: (v: V) => void } :
{};
export type TransactionObject<T> =
T extends string | number | boolean | Function | undefined | null ? T :
T extends {} ? { [K in keyof T]: TransactionObject<T[K]> } & Base<T> : never;
type TransactionOptions = {
commit: () => void;
@zwade
zwade / pinboool.py
Created August 16, 2020 18:04
Reimplementation of DEF CON 2020's Pinboool Binary
from typing import Tuple, Dict, List, TypedDict
import copy
import struct
from functools import cached_property
import math
from pwnlib.util.packing import flat, u16
def twos_byte(b):
b = b & 0xFF
if b <= 0x7F:
@zwade
zwade / pinboool.py
Created August 16, 2020 18:04
Reimplementation of DEF CON 2020's Pinboool Binary
from typing import Tuple, Dict, List, TypedDict
import copy
import struct
from functools import cached_property
import math
from pwnlib.util.packing import flat, u16
def twos_byte(b):
b = b & 0xFF
if b <= 0x7F:
@zwade
zwade / decode.ts
Last active September 29, 2019 10:12
Disassembler for Dragon CTF 2019 Mysterious CPU Problem
#!/usr/bin/env ts-node
import * as fs from "fs-extra";
import { symlinkSync } from "fs-extra";
let color = (num: number) => (data: any) => `\x1b[38;5;${num}m${data}\x1b[0m`;
let gray = color(0);
let red = color(1);
let green = color(2);
let yellow = color(3);