Run with
find . -type f -name '*.json' | xargs -n 1 python convert_json_to_msgpack.py
echo '{"foo": "lorem", "bar": "ipsum"}' | python -m json.tool | |
# or if pjson installed | |
echo '{"json":"obj"}' | pjson |
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) |
Run with
find . -type f -name '*.json' | xargs -n 1 python convert_json_to_msgpack.py
<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> |
<link rel="import" href="../cool-clock/cool-clock.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; | |
width: 100%; | |
height: 100%; |
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)] |