Skip to content

Instantly share code, notes, and snippets.

////
////
//// GB.H
////
////
// NOTE(bumboni): GameBoy technical data
//
// CPU: LR25902
// Clock speed: 4.194304MHz
import pygame;
import math;
pygame.init();
pygame.display.init();
pygame.display.set_mode(size=(600,400));
to_render = [
# bottom edge
[(0,0,0), (0,0,1), (1,0,0)],
@flysand7
flysand7 / linalg.py
Created February 28, 2021 07:38
Helper for performing operations on matrix elements
print('enter row count:');
row_count = int(input());
print('enter col count:');
col_count = int(input());
print(f'creating matrix size %dx%d' % (col_count, row_count));
m = [];
@flysand7
flysand7 / stack_swap.py
Last active March 13, 2021 12:51
This is a program that swaps two stack contents using third stack.
n = 10
# stack data
class t_stack:
arr = 0;
top = 0;
def __init__(self):
self.arr = [];
# This script correctly sorts strings that contain mix of characters
# and numbers.
# For example it is common for files in filesystems to
# have the following names:
# "file1"
# "file2"
# ...
# "file10"
# Though most operating systems sort blindly by comparing
@flysand7
flysand7 / webserver.c
Created September 24, 2021 18:26
Ultra minimal HTTP web server with winsock 2.
#include<stdbool.h>
#include<stdio.h>
#define WIN32_LEAN_AND_MEAN
#include<Winsock2.h>
#include<Ws2tcpip.h>
#define nil ((void *)0)
#define kb 1024
#define LO32(x) (x&((UINT64_C(1)<<32)-1))
#define HI32(x) (x >> 32)
// Returns the high 64-bits of the 128-bit result.
// the `result` variable specifies the address of the low 64-bits
static uint64_t add_u64(uint64_t *result, uint64_t a, uint64_t b)
{
uint64_t al = LO32(a);
uint64_t ah = HI32(a);
package main;
import (
"fmt"
"net/http"
"io"
"os"
"path"
"path/filepath"
"github.com/fsnotify/fsnotify"
#include<stdio.h>
#pragma message "Enable SSE? (Enter 0 or 1)"
enum {
sse =
#include</dev/stdin>
};
#pragma message "Enable Logging? (Enter 0 or 1)"
// This code is Public Domain
// General information:
// Thread safety: none, wrap in a mutex or something
// Allocator type: combination of freelist and bitmap allocator
// Usage:
// include bballoc.h in every file that uses functionality from the library.
// define bballoc_implementation in EXACTLY one of the files.