Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |
#!/usr/bin/env python | |
# | |
# Converts any integer into a base [BASE] number. I have chosen 62 | |
# as it is meant to represent the integers using all the alphanumeric | |
# characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
# | |
# I plan on using this to shorten the representation of possibly long ids, | |
# a la url shortenters | |
# |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!flask/bin/python | |
from flask import Flask, jsonify, abort, request, make_response, url_for | |
from flask_httpauth import HTTPBasicAuth | |
app = Flask(__name__, static_url_path = "") | |
auth = HTTPBasicAuth() | |
@auth.get_password | |
def get_password(username): | |
if username == 'miguel': |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
""" | |
A simple proxy server. Usage: | |
http://hostname:port/p/(URL to be proxied, minus protocol) | |
For example: | |
http://localhost:8080/p/www.google.com | |
""" |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
Compatible with and updated for Warlords of Draenor. | |
Auras created by Adele of amiyuy.com. | |
For images and video see: http://www.amiyuy.com/wow |
import urllib3 | |
import re | |
from flask import Flask, request, make_response, url_for | |
from flask.ext.cors import CORS | |
app = Flask(__name__) | |
app.config['IGNORE_REQUEST_HEADERS'] = ['content-length', 'host'] | |
app.config['IGNORE_RESPONSE_HEADERS'] = ['connection', 'transfer-encoding', | |
'keep-alive', 'content-encoding'] | |
cors = CORS(app) |
import binascii | |
import struct | |
class Punk(object): | |
_END_CHUNK_TYPE = 'IEND' | |
_PUNK_CHUNK_TYPE = 'puNk' | |
_MAX_BYTES = 2147483647 | |
_chunks = dict() |