Skip to content

Instantly share code, notes, and snippets.

Kasper Fabæch Brandt poizan42

Block or report user

Report or block poizan42

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@poizan42
poizan42 / StreamTools.cpp
Last active Aug 29, 2015
ClrHacks. Kids, don't try this at home.
View StreamTools.cpp
// StreamTools.h
#pragma once
#include "StdAfx.h"
using namespace System;
using namespace System::IO;
using namespace System::Runtime::InteropServices;
View CCITTFaxFileScan.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CCITTFaxFileScan
{
class Program
@poizan42
poizan42 / get-undelivered-list.py
Created May 27, 2014
Script which generates a json formatted list of email adresses and reasons from bounce mails loaded from an imap account
View get-undelivered-list.py
#!/usr/bin/env python
import imaplib
import email
import json
import re
from getpass import getpass
label = "undelivered-mails"
username = "user@gmail.com"
addrfilename = 'failed-addresses.txt'
View poor-mans-parameterized-queries.php
<?php
class MySQLException extends Exception
{
private $errNo;
private $errStr;
public function __construct($message = null, $errNo = null, $errStr = null)
{
$this->message = $message;
$this->errNo = $errNo;
View wolf128.sml
(* ex: set ts=2 sw=2 et ai: *)
use "InstagraML.sml";
local
fun rayMarch (x,y,z) =
let
val xdist0 = (((x-160) * z + 4096) div 256) mod 256
val ydist = (((y-100) * z + 4096) div 256) mod 256
val xdist = case z div 64 of
View keybase.md

Keybase proof

I hereby claim:

  • I am poizan42 on github.
  • I am poizan42 (https://keybase.io/poizan42) on keybase.
  • I have a public key whose fingerprint is 66C6 C343 F614 65F9 248E 204E B00A C5E2 7BCE D2B8

To claim this, I am signing this object:

View IOMonad.sml
(* const : 'a -> 'b -> 'a
* Giver den konstante funktion der giver x. *)
fun const x _ = x
(* Lad os få os en IO monade så vi ikke skal se på alt det urene snask. *)
signature IOSig = sig
type 'a io
(* Monade operationer *)
val >>= : 'a io -> ('a -> 'b io) -> 'b io
val >> : 'a io -> 'b io -> 'b io
@poizan42
poizan42 / triangular.v
Created Nov 11, 2014
Proof of the closed form formula for triangular numbers
View triangular.v
Require Import Coq.Arith.Div2.
Require Import Coq.Arith.Mult.
Require Import Coq.Arith.Even.
Require Import ArithRing.
Fixpoint triangular (n: nat) :=
match n with
| 0 => 0
| S n => (S n) + triangular (n)
end.
View bedre_write_int.c
void write_int(int n) {
// Length of INT_MIN as a decimal number is 11 (-2147483647)
char buf[11];
int neg = n < 0;
n *= 1 - 2*neg;
int pos = 11;
do {
buf[--pos] = '0' + (n % 10);
n /= 10;
} while (n);
@poizan42
poizan42 / wmain-call-stub.cpp
Last active Aug 29, 2015
stub to call wmain from main
View wmain-call-stub.cpp
#include <string>
#include <codecvt>
#include <locale>
int main(int argc, const char *argv[])
{
std::wstring_convert < std::codecvt<wchar_t, char, std::mbstate_t> > conv;
std::vector<const wchar_t*> wargv;
std::vector<std::wstring> wsargv;
wargv.resize(argc);
You can’t perform that action at this time.