Skip to content

Instantly share code, notes, and snippets.

View wilkie's full-sized avatar
☠️
screaming into the void

wilkie wilkie

☠️
screaming into the void
View GitHub Profile
http://www.qwantz.com/index.php?comic=2135
88_88 staring intently tarantula
88‿88 smiling tarantula
88ᴗ88 SMILING tarantula
88Д88 angered tarantula
@wilkie
wilkie / builtins.c
Created May 3, 2012 06:25 — forked from avdi/builtins.c
C builtins
void strcpy(char* dest, char* src) {
src = "aaa";
while(*dest++ = *src++);
}
int main(void) {
char buff[64];
strcpy(buff, "Look ma, ");
strcat(buff, "no #includes");
printf(buff);
@wilkie
wilkie / new_expressions.d
Created May 16, 2012 07:51
Some weird obscure D syntax.
/+
Inner classes contain a hidden field that contains a reference to the
instance of the outer class. D has a special 'new' expression that can
be used to create instances of inner classes and attach them to outer
class instances.
+/
// Using printf
extern(C) int printf(char*, ...);
@wilkie
wilkie / parser.js
Created July 4, 2012 17:23
Example recursive-descent parser in js for a simple cfg
// Parses the following CFG (assuming the only characters are '(' and ')')
// A -> B | ""
// B -> ( B ) | ( )
function parseA(tokens) {
if (tokens[0].length === 0) {
// A -> ""
return true;
}
@wilkie
wilkie / opengl-transparency-demo.cpp
Created September 5, 2012 20:46
Rendering directly to a composited window in vista+ with opengl.
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <windowsx.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <dwmapi.h>
#pragma comment (lib, "opengl32.lib")
@wilkie
wilkie / framework.md
Created October 6, 2012 22:57
An Infrastructure to Promote Sustainable Coding

An Infrastructure to Promote Sustainable Coding

We have long promoted the idea of the re-usability of our code. After an era of writing for our machines instead of ourselves, we discovered that human literacy was preferred over performance. From this notion, we developed higher level languages that started to abstract and even completely obscure the underlying machine. A beautiful era emerged where the Turing machine was our model, and humans our audience.

However, these methods of human expression are not compatible. Although they all express and run upon the same theoretical basis, they cannot collaborate effectively. This is due, ironically, to the constraints set upon the languages at the machine level. For instance, {Rust, D, Java} implies a garbage collector to allow object expressions that ignore allocations and to better analyze the lifetimes of these objects. When the language constrains the type of garbage collector policy, this constrains the languages that can be used together.

However, it is

@wilkie
wilkie / reply.txt
Created October 13, 2012 17:30
reply
My reply to http://laurasanders.net/a-primer-on-sexism-in-the-tech-industry-by-an-actual-girl/
Thank you for writing this article. I do appreciate your comments on the original article, and pointed out some problems I had not seen at first.
However, just as he is clearly over-generalizing, you may be under-generalizing. The systemic oppression of women in this field is indeed strong
and undermines female involvement. Let me go through your points.
1. It's true. The article does not tackle sexism directly. http://rarlindseysmash.com/index.php?n=1313531468 is an article about sexism. Written
by a woman. Uses facts and citations.
Does he need to define the words? Unfortunately yes. You tell a white-male-techy that they are using 'privilege' and they'll respond 'I've never
@wilkie
wilkie / experiment.rb
Created November 19, 2012 23:51
Code to produce a probability distribution of how likely a gender breakdown in conference speakers is, and also to experiment to produce the result
# This program will select at random a set of speakers and look at the gender breakdown given 20% women
total_speakers = 15
percentage_of_women = 0.25
hist, list, results = {}, [], []
(1000 * (1 - percentage_of_women)).floor.times{list << 0}
(1000 * percentage_of_women).floor.times{list << 1}
@wilkie
wilkie / atomic_counter.cpp
Created December 19, 2012 05:22
A lock-free reference counter. These two classes offer an easy method of ensuring copies of classes with data that must be reclaimed can only be reclaimed when all other copies are destroyed. It uses an atomic compare and exchange method of managing a counter without using an explicit mutex, so it is thread safe. I didn't want to use a smart poi…
#include "atomic_counter.hpp"
AtomicCounter::AtomicCounter() {
AtomicCounter(0);
}
AtomicCounter::AtomicCounter(unsigned int value) :
_value(value) {
}
@wilkie
wilkie / put_in_address_bar
Last active December 11, 2015 23:49
Some people really linked the browser notepad in one line thing... well have some syntax highlighting... still in one line. Ok, fine. A really long line. And I cheated so hard that the caret doesn't show up, but that's ok, right? :) Oh, and you can't copy and paste in HTML because contenteditable is really broken for pre tags, jeez.
data:text/html, <style>@import url(http://fonts.googleapis.com/css?family=Inconsolata);html,body{background-color:%233f3f3f}%23f,%23d{background-color:rgba(0,0,0,0);margin:0;padding:3px;font-size:14px;font-family:'Inconsolata';display:block}pre .nocode {background-color:none;color:%23000}pre .str{color:%23cc9393}pre .kwd{color:%23f0dfaf}pre .com{color:%237f9f7f}pre .typ {color:%23dfdfbf}pre .lit{color:%238cd0d3}pre .pun{color:%23fff}pre .pln{color:%23dcdccc}pre .tag{color:%23e89393;font-weight:bold}pre .atn{color:%23dfdfbf;font-weight:bold}pre .atv{color:%23dca3a3}pre .dec{color:%23efdcbc}ol.linenums{margin-top:0;margin-bottom:0;color:%23AEAEAE}li.L1,li.L3,li.L5,li.L7,li.L9{}%23m{position:relative;z-index:1;color:rgba(0,0,0,0);border:1px solid %23888}%23d{z-index:0;position:absolute;left:0px;top:0px}%23p{position:relative}</style><script src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js" type="text/javascript"></script><div id="p"><pre id="m"><code id="f" oninput='d=document.getElement