Skip to content

Instantly share code, notes, and snippets.

View DrFrankenstein's full-sized avatar
💻
Compiling...

Carl Tessier DrFrankenstein

💻
Compiling...
View GitHub Profile
@DrFrankenstein
DrFrankenstein / damnpacketparser.cpp
Created May 26, 2011 19:11
Packet parser for dAmn in C++/Qt
/*
This file is part of
amnlib - A C++ library for deviantART Message Network
Copyright © 2011 Carl Tessier <http://drfrankenstein90.deviantart.com/>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@DrFrankenstein
DrFrankenstein / ValidHtml.html
Created June 29, 2011 03:32
Valid HTML document that no brower can parse.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd" [
<!ENTITY % FauxLatin 'INCLUDE'>
<!ENTITY % English 'IGNORE'>
<!ENTITY % French 'INCLUDE'>
]>
<html<head>
<title/Hello, World!/
</head<body<div>
<p/This is a paragraph./
@DrFrankenstein
DrFrankenstein / evenodd.asm
Created August 3, 2011 01:12
I thought it would become iterative in some way.
; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.40219.01
TITLE C:\Users\Carl Tessier\Documents\Visual Studio 2008\Projects\ctest\ctest\main.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB OLDNAMES
@DrFrankenstein
DrFrankenstein / JsonFetcher.js
Created October 2, 2011 05:26
Json fetcher in JavaScript
function JsonFetcher(url) {
this.url = url;
this.request = new XMLHttpRequest();
this.request.addEventListener("readystatechange",
goog.bind(this._onReadyStateChange, this));
}
JsonFetcher.prototype = {
url: "",
request: null,
@DrFrankenstein
DrFrankenstein / swaps.c
Created October 27, 2011 00:54
Comparing the performances of various value swapping techniques
#include <stdlib.h>
#include <limits.h>
#include <time.h>
#include <stdio.h>
/* Optimizations enabled EXCEPT for function inlining. */
extern void xchg_swap(int*, int*);
extern void xchg_swap_loop(int);
void in_place_swap(int* x, int* y)
@DrFrankenstein
DrFrankenstein / csb.c
Last active December 25, 2015 22:39
C String Builder
#include "csb.h"
#include "csb_private.h"
#include "csb_elem.h"
#include <stdlib.h>
#include <string.h>
str_builder sb_init(const char* initstr)
{
str_builder sb = (str_builder) malloc(sizeof(struct str_builder_impl));
@DrFrankenstein
DrFrankenstein / 24game.c
Created July 22, 2015 16:09
Implementation of the 24 game as described in <http://rosettacode.org/wiki/24_game>.
#include <stddef.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#include <stdio.h>
#include <math.h>
/* double parentheses don't disable the assignment-in-condition warning in CL */
#pragma warning(disable:4706)
@DrFrankenstein
DrFrankenstein / aoc1.asm
Last active February 12, 2016 21:21
Advent of Code 1
.model flat, stdcall
option casemap:none
STD_INPUT_HANDLE equ -10
STD_OUTPUT_HANDLE equ -11
GetStdHandle proto stdcall, nStdHandle:dword
ReadFile proto stdcall, hFile:dword, lpBuffer:ptr byte, nNumberOfBytesToRead:dword, lpNumberOfBytesRead:ptr dword, lpOverlapped:ptr dword
WriteFile proto stdcall, hFile:dword, lpBuffer:ptr byte, nNumberOfBytesToWrite:dword, lpumberOfBytesWritten:ptr dword, lpOverlapped: ptr dword
FORMAT_MESSAGE_ALLOCATE_BUFFER equ 100h
FORMAT_MESSAGE_FROM_STRING equ 400h
@DrFrankenstein
DrFrankenstein / aoc2.c
Last active December 18, 2015 19:10
Advent of Code 2
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#undef min /* dammit, Visual C++! */
struct box
{
unsigned l, w, h;
};
@DrFrankenstein
DrFrankenstein / aoc3.cpp
Last active December 21, 2015 14:29
Advent of Code 3
#include <unordered_map>
#include <utility>
#include <iostream>
#include <boost/functional/hash.hpp>
using std::unordered_map;
using std::pair;
using std::make_pair;
using std::cin;