This file contains hidden or 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
read_tar :: proc(reader: ^io.Reader) { | |
Posix_Ustar_Header :: struct #packed { | |
name: [100]u8, | |
mode: [8]u8, | |
uid: [8]u8, | |
gid: [8]u8, | |
size: [12]u8, | |
mtime: [12]u8, | |
checksum: [8]u8, | |
typeflag: u8, |
This file contains hidden or 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
read_zip :: proc(reader: ^io.Reader) { | |
LOCAL_FILE_MAGIC :: 0x04034B50; | |
END_MAGIC :: 0x06054b50; | |
Local_File_Header :: struct #packed { | |
//signature: u32le, | |
minimum_version: u16le, | |
flags: u16le, | |
compression: u16le, | |
last_mod_time: u16le, |
This file contains hidden or 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
package io | |
import "core:os" | |
import "core:mem" | |
import "core:log" | |
import "core:runtime" | |
Error :: enum { | |
Ok, | |
Could_Not_Create_File, |
This file contains hidden or 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
import os | |
import glob | |
import cv2 | |
import torch | |
from PIL import Image | |
from torch import nn | |
from torchvision import transforms | |
from torch.utils.data import Dataset, DataLoader |
This file contains hidden or 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
#/bin/bash | |
# clos - count lines of semicolons | |
# A simple utility that counts the number of semicolons in the supplied files | |
# NOT the number of lines with semicolons as the name implies, sorry about that | |
## MIT License | |
## | |
## Copyright (c) 2019 Aleksander B. Birkeland | |
## | |
## Permission is hereby granted, free of charge, to any person obtaining a copy |
This file contains hidden or 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
const char* source_to_string(GLenum source) { | |
switch (source) { | |
case GL_DEBUG_SOURCE_API: | |
return "GL_DEBUG_SOURCE_API"; | |
case GL_DEBUG_SOURCE_WINDOW_SYSTEM: | |
return "GL_DEBUG_SOURCE_WINDOW_SYSTEM"; | |
case GL_DEBUG_SOURCE_SHADER_COMPILER: | |
return "GL_DEBUG_SOURCE_SHADER_COMPILER"; | |
case GL_DEBUG_SOURCE_THIRD_PARTY: | |
return "GL_DEBUG_SOURCE_THIRD_PARTY"; |
This file contains hidden or 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
import beeprint | |
import inspect | |
class Node: | |
def eval(self, kwargs): | |
raise RuntimeException('{} did not implement eval()'.format(self.__class__)) | |
def __eq__(self, other): | |
return make_binary('==', self, other) |
This file contains hidden or 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
/* | |
The MIT License | |
Copyright (c) 2019 Aleksander B. Birkeland | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or 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
// Release - x64 | |
void set_background_color(float r, float g, float b); | |
void draw_line(float x0, float y0, float x1, float y1, float r, float g, float b, float a); | |
float print_string(char* text, float x, float y, float size, float r, float g, float b, float a); | |
float print_int(int number, float x, float y, float size, float r, float g, float b, float a); | |
float print_float(float number, int decimals, float x, float y, float size, float r, float g, float b, float a); | |
double math_cos(double x); | |
double math_sin(double x); | |
double math_atan2(double x, double y); |
This file contains hidden or 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
TypeUniformMapping :: struct { | |
typetype: typeid, | |
set_uniform: proc(loc: i32, value: rawptr), | |
} | |
type_to_uniform_map := map[gl.Uniform_Type]TypeUniformMapping{ | |
// If we map typeid to Uniform_Type, we could support stuff like array of floats and vec3s | |
gl.Uniform_Type.FLOAT = {typeid_of(f32), proc(loc: i32, value: rawptr) { | |
gl.Uniform1f(loc, (cast(^f32)value)^); |