Skip to content

Instantly share code, notes, and snippets.

//wb_memory_arena.c
//by William Bundy
// A simple linear allocator using free and malloc
// Should use mmap on linux; calls to VirtualAlloc and VirtualFree are commented out
// arena_end_temp is technically broken; can be implemented much better with virtual memory
//This is free and unencumbered software released into the public domain.
#define LogError(...)
/*
A memcpy replacement; uses SSE2 and _mm_lddqu_si128 from SSE3
It's okay, I guess.
Abuses rep movsb for sizes > 1024b and < 2mb--
--might not work very well on pre Sandy Bridge Intel or AMD in general.
On Skylake, it's about as fast as Microsoft's implementation.
Written by William Bundy
@WilliamBundy
WilliamBundy / .vimrc
Created October 25, 2016 00:36
My vimrc as of 10/24/16
set nocompatible
behave mswin
call plug#begin('C:/Vim/vimfiles/bundle')
Plug 'tomasr/molokai'
Plug 'tpope/vim-surround'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'craigemery/vim-autotag'
Plug 'tikhomirov/vim-glsl'
Plug 'Raimondi/delimitMate'
set nocompatible
behave mswin
call plug#begin('C:/Vim/vimfiles/bundle')
Plug 'tomasr/molokai'
Plug 'tpope/vim-surround'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'craigemery/vim-autotag'
Plug 'tikhomirov/vim-glsl'
call plug#end()
// 1. use List.Add, hope that .ToArray() works
List<string> temp = new List<string>();
temp.Add(desired_username_tb.Text);
temp.Add(new_password_tb.Text);
temp.Add(Email_tb.Text);
DB.login_DB.Add(temp.ToArray());
// 2. Use an array of strings
string[] temp = new string[3];
/*
* rituals_simulation.cpp
*/
#define Flag(x) (1 << x)
#define Has_Flag(x, y) (x & y)
enum Sim_Body_Flags
{
Body_Flag_None,
@WilliamBundy
WilliamBundy / .vimrc
Created June 19, 2016 19:08
My .vimrc
set nocompatible
behave mswin
call plug#begin('C:/Vim/vimfiles/bundle')
Plug 'tomasr/molokai'
Plug 'tpope/vim-surround'
Plug 'vim-scripts/a.vim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'craigemery/vim-autotag'
" Plug 'vim-scripts/AutoComplPop'
@WilliamBundy
WilliamBundy / random.cpp
Created June 18, 2016 15:02
xorshift rng
#include <stdint.h>
typedef uint64_t uint64;
// Random number generators
static inline uint64 _splitmix64(uint64* x)
{
*x += UINT64_C(0x9E3779B97F4A7C15);
uint64 z = *x;
z = (z ^ (z >> 30)) * UINT64_C(0xBF58476D1CE4E5B9);
z = (z ^ (z >> 27)) * UINT64_C(0x94D049BB133111EB);
#!/usr/env python3
game = """
Quick--do you have an apple?
{switch}
{choice 1 "Yeah, I do"}
{choice 2 "*pats pockets* Nope"}
{case 1} {do "set({'apple'}, 'player', 'items')"} {goto "You run into John Appleseed"}
{case 2} {goto "You run into John Appleseed"}
@WilliamBundy
WilliamBundy / bunch.cs
Created June 1, 2015 03:53
Playing around with a more dynamic/JS style in C#
class Bunch : IEnumerable
{
public object this [string name]
{
get
{
try
{
return this.GetType().GetField(name).GetValue(this);
}