Skip to content

Instantly share code, notes, and snippets.

@edhiley
edhiley / feistel.py
Created August 12, 2016 13:50 — forked from whatisaphone/feistel.py
Unlimited length feistel cipher
import hashlib
class FeistelSHA1:
rounds = 4 # 4 rounds is sufficient as long as the round function is cryptographically secure
split = 1 / 2
def __init__(self, key, rounds=rounds):
self.subkeys = [hashlib.sha1(bytes((i,)) + key).digest() for i in range(rounds)]
@edhiley
edhiley / designer.html
Created November 14, 2015 21:27
designer
<link rel="import" href="../cool-clock/cool-clock.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@edhiley
edhiley / designer.html
Last active November 14, 2015 21:24
designer
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<polymer-element name="my-element">
<template>
@edhiley
edhiley / README.md
Created October 15, 2015 10:37
Converting json to msgpack

Run with

find . -type f -name '*.json' | xargs -n 1 python convert_json_to_msgpack.py

from random import choice, shuffle
import string
outwardcode_area_choices = ['LS', 'EN', 'BD']
outwardcode_district_choices = xrange(1,20)
inwardcode_sector_choices = string.digits
inwardcode_alphabet = list('ABDEFGHJLNPQRSTUWXYZ')
def gen_postcode():
shuffle(inwardcode_alphabet)
@edhiley
edhiley / pp_curl.sh
Last active August 29, 2015 14:05
pretty print curl requests
echo '{"foo": "lorem", "bar": "ipsum"}' | python -m json.tool
# or if pjson installed
echo '{"json":"obj"}' | pjson
@edhiley
edhiley / TestDataStrategies.py
Created July 16, 2014 22:18
fetchmany ....
import unittest, sqlite3
from contextlib import closing
class TestDataStrategies(unittest.TestCase):
SQLCMD = """SELECT lid
from person_table
GROUP BY lid
ORDER BY lid"""
@edhiley
edhiley / mrpythonclient.py
Last active August 29, 2015 14:02
Two examples of Riak map reduce, curl and python client
from riak import RiakClient, RiakNode
host, port = 'localhost', '10091'
timeout = 6000000
client = RiakClient(protocol='http', hosts=host, http_port=port)
if not client.ping():
print "Cannot connect to riak on {}:{}".format(host, port)
exit()

Keybase proof

I hereby claim:

  • I am edhiley on github.
  • I am edhiley (https://keybase.io/edhiley) on keybase.
  • I have a public key whose fingerprint is A31E 4773 8142 E5C2 3BC8 C2FF 1D83 B09E 6B62 7DF0

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.