Skip to content

Instantly share code, notes, and snippets.

@rdhyee
rdhyee / README.md
Created November 10, 2012 00:51
created by livecoding - http://livecoding.io/3419313
@rdhyee
rdhyee / soccer
Created April 22, 2013 20:57 — forked from natarajanc/soccer
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <headingcell level=2>
# Soccer 101 - Player Positions
# <codecell>
from IPython.core.display import Image
@rdhyee
rdhyee / gmail-compose-encoder.js
Created October 15, 2020 03:06 — forked from danrouse/gmail-compose-encoder.js
gmail `compose` query parameter encoder/decoder
const fullAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const restrictedAlphabet = 'BCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz';
const threadPrefix = 'thread-';
const messagePrefix = 'msg-';
const isWhitespace = str => /^[\s\xa0]*$/.test(str);
const isInvalidString = str => str ? (str.indexOf(threadPrefix) !== -1 || str.indexOf(messagePrefix) !== -1) : false;
const encode = function(str) {
if (isWhitespace(str)) return str;
@rdhyee
rdhyee / enct2.py
Created December 17, 2020 15:37 — forked from tryone144/enct2.py
Implementation of the AES protocol as used by https://encipher.it
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# implementation of the AES protocol as used by https://encipher.it
#
# (c) 2018 Bernd Busse
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.ciphers.modes import ECB, CTR