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
#!/usr/bin/env python3 | |
# quickgen by azul (@typeswitch@gamedev.lgbt) -- generates a map | |
# by repeated subdivision. a simple approach to generating maps | |
# quickly, starting from a very rough sketch. | |
# | |
# this code is public domain! use it however you like. | |
import random |
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
bits 64 | |
org 0x4000000 | |
elf_header: | |
.size equ .end - $ | |
.e_ident db 0x7F, 'E', 'L', 'F' ; EI_MAG0 ... EI_MAG3 | |
db 2 ; EI_CLASS: 1 => 32 bits, 2 => 64 bits | |
db 1 ; EI_DATA: 1 => lil endian, 2 => big " | |
db 1 ; EI_VERSION: original version | |
db 0 ; EI_OSABI: 0 => System V ABI |
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
org 0 ; We use "org 0" so Relative Virtual Addresses (RVAs) are easy. | |
; This means that when we want an absolute Virtual Address we have | |
; to add IMAGE_BASE to the RVA (or whatever the base of that section is) | |
IMAGE_BASE equ 0x400000 | |
SECT_ALIGN equ 0x200 | |
FILE_ALIGN equ 0x200 | |
msdos_header: | |
.magic db 'MZ' |
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
bits 64 | |
org 0x1000 | |
mach_header: | |
.magic dd 0xFEEDFACF ; MH_MAGIC_64 | |
.cputype dd 0x01000007 ; CPU_ARCH_ABI64 | CPU_TYPE_I386 | |
.cpusubtype dd 0x00000003 ; CPU_SUBTYPE_LIB64 | CPU_SUBTYPE_I386_ALL | |
.filetype dd 0x2 ; MH_EXECUTE | |
.ncmds dd 3 | |
.sizeofcmds dd mach_cmds_end - mach_cmds_start |
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
// deobfuscated version of "FIRST and THIRD" | |
// deobfuscated by Sofia Faro (@typeswitch) | |
// original by Sean Barrett (@nothings) | |
// | |
// original design document: ftp.funet.fi/pub/doc/IOCCC/1992/buzzard.2.design | |
// original obfuscated code: ftp.funet.fi/pub/doc/IOCCC/1992/buzzard.2.c | |
#define comma m[m[0]++] = | |
char s[5000]; |
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 <stdio.h> | |
#include <string.h> | |
#include <assert.h> | |
FILE *in; long M[1<<24]={0}, *D, *R, H=0x130000, IP=0, T; | |
long getu() { long t, h = getc(in); if (h < 0xC0) return h; | |
t = ((h&0x1F) << 6) | (getc(in) & 0x3F); if (h < 0xE0) return t; | |
t = ( t << 6) | (getc(in) & 0x3F); if (h < 0xF0) return t; | |
t = ( t << 6) | (getc(in) & 0x3F); return t & 0x1FFFFF; } | |
void putu(long c) { if (c < 0x80) { putchar(c); return; } | |
if (c < 0x7FF) { putchar(0xC0|(c>>6)); } else { |
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
CFLAGS=-std=c99 -pedantic -Wall -Werror | |
.PHONY: run forth | |
run: forth | |
./forth test.fs | |
forth: forth.c | |
$(CC) $(CFLAGS) -o forth forth.c |
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": ["lit", "Hello, world!", "print"] | |
} |
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
# Calculates e using randomized bogosort. The average number | |
# of comparisons per round should be close to e-1 due to | |
# shortcircuiting, so we run bogosort and keep track of | |
# the number of rounds and number of comparisons, and use | |
# that to calculate e. | |
import random | |
n = 10 |
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 "SDL.h" | |
#define SAMPLE_RATE 48000 | |
#define CHANNELS 2 | |
#define SAMPLES (SAMPLE_RATE*2) | |
int main (int argc, char** argv) | |
{ | |
SDL_Init(SDL_INIT_EVERYTHING); |
NewerOlder