Skip to content

Instantly share code, notes, and snippets.

#include <algorithm>
#include <array>
#include <chrono>
#include <cstdint>
#include <cstdio>
#include <random>
#include <vector>
using namespace std;
using namespace std::chrono;
@bseibold
bseibold / lazy-ssh-agent.sh
Created February 28, 2013 14:09
Lazy Loading for ssh-agent keys. Loads default SSH identities on demand. Tested with bash and zsh.
function wrapssh() {
setopt shwordsplit &>/dev/null
# load agent if it's not running
if [ -z "$SSH_AUTH_SOCK" ]; then
eval $(ssh-agent) &>/dev/null
fi
# load keys if necessary
DO_ADD=0
@bseibold
bseibold / mystanza.lua
Created February 27, 2013 13:18
Minimized stanza.lua from Prosody, containing a fix/workaround, for use with prosody_to_xep227.lua https://gist.github.com/bseibold/5041603
-- Prosody IM
-- Copyright (C) 2008-2010 Matthew Wild
-- Copyright (C) 2008-2010 Waqas Hussain
--
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--
local t_insert = table.insert;
@bseibold
bseibold / prosody_to_xep227.lua
Last active November 16, 2017 20:54
Export Prosody data to XEP-0227 / XEP 227 / PIEFXIS format
#!/usr/bin/env lua
--
-- (c) 2013 Bernhard Seibold
-- License: MIT/X11
--
-- Disclaimer:
-- ===========
--
@bseibold
bseibold / uulmfcuk.py
Last active October 13, 2016 10:53
Read Uni Ulm Mifare Cards
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from sys import exit
import struct
try:
from smartcard.System import readers
from smartcard.util import toHexString
except:
@bseibold
bseibold / gist:3290659
Created August 7, 2012 23:52
Installed debian packages by size
dpkg-query -Wf'${Status} ${Installed-Size} ${Package}\n'| sed -ne's/^install ok installed //p' | sort -n
@bseibold
bseibold / CPSBreaks.scala
Created December 29, 2010 15:36
reimplementation of scala.util.control.Breaks using Scala 2.8 Continuations
trait Breaks {
import scala.util.continuations.{reset,shift}
def breakable = reset[Unit,Unit] _
def break = shift { k: (Unit => Unit) => () }
}
object CPSBreaks extends Application with Breaks {
breakable {