Skip to content

Instantly share code, notes, and snippets.

View poizan42's full-sized avatar

Kasper Fabæch Brandt poizan42

View GitHub Profile
@poizan42
poizan42 / checkmail.php
Created May 19, 2012 18:10
Mail verifier in php
<?php
/*
Copyright (C) 2012 Kasper F. Brandt
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
@poizan42
poizan42 / jsquine.js
Created July 29, 2012 20:08
javascript quine-bomb
a1="function a() { p='a1=\"'+a1.replace(/\\\\/g,'\\\\\\\\').replace(/\"/g,'\\\\\"')+'\"; a2=\"'+a2+'\";'+a1+a2;";
a2="document.write('<script>' + p + '</'+'script>');document.write('<script>' + p + '</'+'script>')}a()";
function a() {
p='a1="'+a1.replace(/\\/g,'\\\\').replace(/"/g,'\\"')+'"; a2="'+a2+'";'+a1+a2;
document.write('<script>' + p + '</'+'script>');
document.write('<script>' + p + '</'+'script>')
}a()
@poizan42
poizan42 / gist:5061991
Last active December 14, 2015 08:59
Fix all git committer dates to author dates
# Fix all git committer dates to author dates:
git filter-branch --env-filter \
'export GIT_COMMITTER_DATE="$(git show --pretty=fuller $GIT_COMMIT | grep "AuthorDate:" | sed -re "s/^AuthorDate:\s+(.*)$/\\1/")"'
@poizan42
poizan42 / brainfuck.htm
Created October 4, 2013 00:31
Brainfuck intepreter written in JavaScript (and HTML)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!--
Brainfuck interpreter in JavaScript
Made 2009 by Kasper F. Brandt
I hereby release this code (both html and JavaScript) into the public domain
-->
<html>
<head>
<title>Brainfuck interpreter</title>
@poizan42
poizan42 / mx-scrape.php
Last active December 30, 2015 13:39
mx.dk recent news scraper
<?php
class MetroXpress
{
const userAgent = null;
private static $monthMap = Array(
'januar' => 1,
'februar' => 2,
'marts' => 3,
@poizan42
poizan42 / unpack-youtube-dump.py
Last active January 1, 2016 07:59
Read video data from saved combined traffic dumps of a youtube video, such as those created by `tshark -z follow,tcp,raw,...`
#!/usr/bin/python
import sys
import os
from urlparse import urlparse,parse_qs
def readChunk(f):
get = f.readline()
if get == '':
raise EOFError()
@poizan42
poizan42 / StreamTools.cpp
Last active August 29, 2015 13:56
ClrHacks. Kids, don't try this at home.
// StreamTools.h
#pragma once
#include "StdAfx.h"
using namespace System;
using namespace System::IO;
using namespace System::Runtime::InteropServices;
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 09:15
Script which generates a json formatted list of email adresses and reasons from bounce mails loaded from an imap account
#!/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'
<?php
class MySQLException extends Exception
{
private $errNo;
private $errStr;
public function __construct($message = null, $errNo = null, $errStr = null)
{
$this->message = $message;
$this->errNo = $errNo;