Skip to content

Instantly share code, notes, and snippets.

View nekodjin's full-sized avatar

Avery R. nekodjin

View GitHub Profile
#include <stdio.h>
#include <stdint.h>
#include "sum.h"
int main(void) {
uint64_t x = sum(7, 1, 2, 3, 4, 5, 6, 7);
printf("%llu\n", x);
@nekodjin
nekodjin / demo.md
Created October 24, 2021 17:01
Demo of Rust Compilation Chain

Rust:

fn main() {
    for i in 1..=10 {
        println!("{}", i);
    }
}

HIR:

@nekodjin
nekodjin / spec.md
Last active October 24, 2021 17:21

YeetSkeet is a stack-based language which uses a primary stack and a secondary stack. for both stacks, the each element shall be exactly one byte.

a program consists of an ordered list of instructions.

YeetSkeet instructions:

0  : push byte 0 to the stack
1  : push byte 1 to the stack
"x : push ascii value of x (which is an ascii char) to the stack
@nekodjin
nekodjin / stash.asm
Created October 27, 2021 22:52
Stash
global ys_stash
%include "macros.asm"
ys_stash:
pop rbx
cmp r14, r15
jne no_allocate
getbrk
mov rbp, rax
@nekodjin
nekodjin / primes.c
Created January 3, 2022 16:03
Simple, portable, and (mostly) UB-free implementation of the Sieve of Eratosthenes in C99
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#define u8 uint8_t
#define u32 uint32_t
int main(void) {
u8 *arr;
u32 i, j, x, c;
@nekodjin
nekodjin / fds.asm
Last active January 3, 2022 21:43
Linux x64 Hello World with NASM
%define fd_stdin 0
%define fd_stdout 1
%define fd_stderr 2
@nekodjin
nekodjin / keybase.md
Created January 16, 2023 05:31
keybase.md

Keybase proof

I hereby claim:

  • I am nekodjin on github.
  • I am nekodjin (https://keybase.io/nekodjin) on keybase.
  • I have a public key ASCxd4EFF6ISYsTnWe0AHAAgUwtBhrQj9esbVBSMkltUbQo

To claim this, I am signing this object:

@nekodjin
nekodjin / Hamburger.svelte
Created May 8, 2023 21:59
A mockup hamburger menu.
<script lang="ts">
let showHamburger = false;
const toggleHamburger = () => {
showHamburger = !showHambuger;
};
</script>
<div class="h-screen flex flex-col justify-center items-center content-evenly gap-y-4">
<button on:click={toggleHamburger}>
module Example where
printGreeting :: IO ()
printGreeting = putStrLn "Hello, user!"