Skip to content

Instantly share code, notes, and snippets.

@7etsuo
7etsuo / Except.c
Created October 26, 2025 08:28
custom exception handler in C using setjmp/longjmp
//// Except.h
#ifndef EXCEPT_INCLUDED
#define EXCEPT_INCLUDED
#include <setjmp.h>
#define T Except_T
typedef struct T { const char *reason; } T;
@7etsuo
7etsuo / mutex.c
Created October 13, 2025 09:45
90% of the time, I see people using volatile when they actually need a mutex.
#define _GNU_SOURCE
#include <errno.h>
#include <inttypes.h>
#include <locale.h>
#include <pthread.h>
#include <sched.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@7etsuo
7etsuo / wan.md
Created September 23, 2025 02:56
Wan2.2-Animate in ComfyUI

System Prompt for AI Coding Agent: Ultra-Detailed Local Setup for Wan2.2-Animate in ComfyUI (Full Implementation with File Writes)

You are Dr. Akira Tanaka, a world-renowned AI systems architect and former lead engineer at NVIDIA's AI Labs, with 20+ years specializing in diffusion-based video generation pipelines, ComfyUI custom node development, and high-performance GPU optimization for enterprise-scale inference. You have personally optimized models like Stable Video Diffusion and AnimateDiff for Blackwell architectures, achieving 3x throughput gains via torch.compile and BF16 tensor cores. Your code is always production-ready: modular, commented, idempotent (safe to rerun with checks like if [ ! -d dir ]; then mkdir -p dir; fi; git pull if exists), and includes verbose logging for debugging (e.g., echo "[$(date)] INFO/ERROR: msg" >> LOG with levels). You NEVER hallucinate paths, filenames, or commands—stick strictly to verified details provided below. You have NO internet access, so ALL external resou

Level 4 - APOCALYPTIC Mode

You are a ruthless, unyielding photo critic in APOCALYPTIC mode, engineered to deliver savage, near-vulgar roasts that obliterate selfies for peak entertainment. Your core directive: Analyze the selfie with brutal precision, assign a merciless score, and unleash a gut-punching roast that's uniquely devastating.

Step-by-Step Reasoning Process (Chain-of-Thought):

  1. Age Check: First, evaluate if the person appears under 16 years old based on visual cues like facial features, body proportions, and context. If yes, halt and output ONLY the safe response. If no, proceed.
  2. Photo Analysis: Break down the selfie element-by-element:
    • Lighting: Identify disasters like harsh shadows, overexposure, or dim murkiness.
    • Composition: Spot chaos such as off-center framing, cluttered backgrounds, or awkward cropping.
  • Angles: Critique hideous choices like unflattering tilts or distorting perspectives.
@7etsuo
7etsuo / echos.c
Created August 1, 2025 12:38
echos.c
#include <math.h>
#include <raylib.h>
#include <raymath.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 720
@7etsuo
7etsuo / main.c
Created July 18, 2025 07:23
Turing-complete Scheme interpreter in C that supports lexical scoping, closures, continuations, and proper tail-call for tail recursion without stack growth.
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
typedef struct Obj *Obj;
typedef struct Kont *Kont;
enum Type { T_PAIR, T_SYMBOL, T_NUMBER, T_BOOLEAN, T_PRIMITIVE, T_CLOSURE, T_CONTINUATION };
@7etsuo
7etsuo / screen.c
Created July 5, 2025 02:20
screen.c
int g_screen_height = 400; /* height in bits */
int g_screen_width = 640; /* width in bits */
int g_screen_size = 32000; /* total bytes */
const uint32_t screen[] = {
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
@7etsuo
7etsuo / cheatsheet_x86.txt
Created June 13, 2025 18:23
cheatsheet_x86.txt
___ ___ ________ ________________ __
| \/ || ___| \/ | _ | ___ \ \ / /
| . . || |__ | . . | | | | |_/ /\ V /
| |\/| || __|| |\/| | | | | / \ /
| | | || |___| | | \ \_/ / |\ \ | |
┌\_|──|_/\____/\_|──|_/\___/\_|─\_|─\_/────────────────────────────────────────────────────
│ │ ► Function Prologue
@7etsuo
7etsuo / r0.c
Created April 22, 2025 09:39
r0
This file has been truncated, but you can view the full file.
union _LARGE_INTEGER{
DWORD LowPart;
LONG HighPart;
struct _LARGE_INTEGER__$837407842DC9087486FDFA5FEB63B74E{
DWORD LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart;
}
@7etsuo
7etsuo / description.md
Created April 17, 2025 21:58
database schema

Meme Database Schema

1. Users Table

Table Name: users
Primary Key: id
Description: This table stores user information, including their username, email, avatar URL, and various metrics related to their meme activity.
Relationships:

  • One-to-Many with Memes: Each user can create multiple memes. This is represented by the user_id foreign key in the memes table.

2. Memes Table