Skip to content

Instantly share code, notes, and snippets.

Stephen Paulger stephenpaulger

  • Cambridge, UK
Block or report user

Report or block stephenpaulger

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
stephenpaulger / function_identifiers.go
Created Aug 6, 2018
Extract golang function identifiers
View function_identifiers.go
package main
import (
stephenpaulger / bubble_sort.asm
Created Jun 3, 2017
Assembler simulator bubble sort
View bubble_sort.asm
; Runs on
MOV C, data ; C tracks the address of end
ADD C, 16 ; of the unsorted section of data.
DEC C ; One byte is sorted each pass
MOV D, data ; Start of the data
import timeit
import random
from math import log, ceil
def sum_digits(num):
sum_dig = 0
while num > 0:
last_digit = num % 10 # extract the last digit
stephenpaulger /
Created Mar 12, 2012
Why two time pads are a BadThing™
#!/usr/bin/env python
def xor_int_tuple(tup):
return reduce(lambda a,b:a^b, tup)
def xor_tuple(tup):
return ord(tup[0]) ^ ord(tup[1])
def encrypt(m, k, op=xor_tuple):
return map(op, zip(m, k))
import signal
import sys
import time
def handle(sig, frame):
print all_signals[sig]
all_signals = dict((getattr(signal, attr), attr) for attr in dir(signal) if attr.startswith("SIG"))
View erlang sieve of eratosthenes.erl
sieve(N) ->
[1 | sieve(lists:seq(2, N), N)].
sieve([Head|L], N) when Head * 2 < N ->
[Head | sieve(L -- lists:seq(Head * 2, N, Head), N)];
sieve([Head|L], _) ->
You can’t perform that action at this time.