Skip to content

Instantly share code, notes, and snippets.

View kvanbere's full-sized avatar
:octocat:
We write and test real time control software. @cuedo

Kyle Van Berendonck kvanbere

:octocat:
We write and test real time control software. @cuedo
View GitHub Profile
@kvanbere
kvanbere / Handler.cpp
Created June 30, 2012 06:42
C++ Error Handling by TheNullz + Ghoul
// #include "GhoulTrainer.h"
#define AllocateBuffer(len) \
new TCHAR[##len]
#ifndef Error
#define Error(func) \
HandleError(TEXT(#func), TEXT(__FILE__), __LINE__)
#endif
@kvanbere
kvanbere / twittergrab.py
Created August 18, 2012 15:00
Loads X number of lines off the public Twitter stream
#
# by Kyle Van Berendonck
# kvanberendonck@gmail.com
#
from urllib2 import *
import sys
import json
import difflib
@kvanbere
kvanbere / Packets.hs
Created October 6, 2012 07:44
Converting the Minecraft Coalition data found @ http://mc.kev009.com into Haskell
--
-- Things to do:
-- add missing types, find an acceptable way to render an invalid type (null?)
--
-- Need the Data.Text library later, so make alias
import qualified Data.ByteString as BS
import Data.Serialize
import Data.Word
@kvanbere
kvanbere / fix-UBIF-typo.dsl
Created November 10, 2012 03:47 — forked from Lekensteyn/fix-UBIF-typo.dsl
ACPI UBIX fix for Toshiba Satellite L750D
/*
* ACPI UBIX fix for Toshiba Satellite L750D
* https://bbs.archlinux.org/viewtopic.php?id=152543
*
* Symptoms:
* ACPI Exception: AE_AML_PACKAGE_LIMIT, Index (0x0000000000000011) is beyond end of object (20120320/exoparg2-418)
* ACPI Error: Method parse/execution failed [\_SB_.BAT1.UBIX] (Node ffff880203e8a168), AE_AML_PACKAGE_LIMIT (20120320/psparse-536)
* ACPI Error: Method parse/execution failed [\_SB_.BAT1._BIX] (Node ffff880203e8a0f0), AE_AML_PACKAGE_LIMIT (20120320/psparse-536)
* ACPI Exception: AE_AML_PACKAGE_LIMIT, Evaluating _BIX (20120320/battery-419)
*
-- Description: A red-black tree implementation in Haskell
-- Author: Cedric Van Goethem
-- Version 1, 2013
type Tree a = Node a
data Color = Red | Black deriving (Eq, Show)
data Node a = Node a Color (Node a) (Node a) | Nil deriving (Eq, Show)
tree :: (Ord a) => a -> Tree a
tree x = Node x Black Nil Nil
@kvanbere
kvanbere / gist:5350146
Last active September 24, 2022 17:26
Semi-Generic CRC Bypass for MapleStory
/*
Semi-Generic CRC Bypass for MapleStory
Other uncredited authors for ideas/methods/concepts etc.
*/
#include <Windows.h>
static LPVOID lpvImgStart, lpvImgEnd, lpvMemBackup;
@kvanbere
kvanbere / quicksort.c
Created April 10, 2013 06:22
Aggressively Golfed C-99 Quicksort
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char str_[] = "C programming is fun!", *buf_, tmp_;
void sort(char *src_, char *dst_, int n_)
{
if (!src_[n_] || (n_ <= 1)) return;
if (dst_[n_] >= (tmp_ = dst_[n_ - 1])) return;
@kvanbere
kvanbere / singleton.cpp
Created June 13, 2013 13:59
A singleton implementation which uses static singletons so you only need to use get<type>()->...
#include <iostream>
template <typename T>
class singleton
{
private:
static T* instance;
public:
static T* get()
@kvanbere
kvanbere / optimize.hs
Last active December 18, 2015 23:38
Boolean expression optimizer.
import Data.Char
data Expr
= Nand Expr Expr
| And Expr Expr
| Or Expr Expr
| Not Expr
| Input Int
deriving (Eq)
#include <stdio.h>
#if defined(__GNUC__)
#define unreachable() \
__builtin_unreachable()
#define assertion(cond) \
do \
{ \