Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@moo3
moo3 / cors_server.py
Last active May 20, 2018 05:25 — forked from enjalot/cors_server.py
Allow CORS with python simple http server
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
var o = {
first: {
a: 1,
b: 2,
c: {
second: {
a: 1,
b: {
third: {
a: 1
@moo3
moo3 / crypto1
Last active September 6, 2017 02:25
var refText, encodedMessage, decodedMessage;
function decodeMessage(ref, key) {
var keyArr = key.split('');
var keyArrCopy = [].concat(keyArr);
var dict = [];
var result = '';
while(keyArr.length > 0) {
var k = keyArr.splice(0, keyArr.shift()).join('');