Skip to content

Instantly share code, notes, and snippets.

View snail5008's full-sized avatar
:octocat:

snail5008

:octocat:
View GitHub Profile
@snail5008
snail5008 / templates.py
Created April 12, 2023 08:00
Templates in C -- basically what you see in your nightmares
#!/usr/bin/env python3
import sys
with open(sys.argv[1], 'r') as f:
contents = f.read()
contents += "\n\n"
i = 0
final_str = ""
while i < len(contents) - 1:
@snail5008
snail5008 / main.s
Created April 7, 2022 02:16
A 'Hello World' program in GAS for linux x86_64
.global _start
.section .data
message: .ascii "Hello, World!\n"
len = . - message
.section .text
_start:
movq $1, %rax # sys_write
movq $1, %rdi # stdout
@snail5008
snail5008 / Vector.c
Created March 4, 2022 22:21
A dynamic vector struct thing
#include "Vectors.h"
void IntVectorInit(IntVector* vec) {
// Initaliase the element count to zero, allocate 0 byes for the
// vector pointer, and mark deleted as false.
vec->element_count = 0;
vec->vector = malloc(0);
vec->deleted = false;
}