-
Install
gunicornandrequests:$ pip install gunicorn requests -
Save
pyrate.pyto a directory and run the proxy from that directory:
$ gunicorn --workers 4 pyrate:app
| #!/usr/bin/env python | |
| import heapq | |
| def dijkstra(tree, start, end): | |
| """Dijkstra's algorithm for finding shortest path.""" | |
| queue = [(0, start, (start, ))] | |
| seen = set() |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Loading...</title> | |
| <meta charset="utf-8" /> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"></script> | |
| <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" type="text/javascript"></script> | |
| <script type="text/x-mathjax-config"> | |
| MathJax.Hub.Config({ |
| #' Combine (nested) lists left-to-right | |
| #' | |
| #' @param ... lists to be combined. | |
| combine = function(...) { | |
| stack = rev(list(...)) | |
| names(stack) = rep('', length(stack)) | |
| result = list() | |
| while (length(stack)) { |
| @echo off | |
| start /B "" pythonw "%~dp0active.py" %* |
| """ | |
| Encrypt data. | |
| """ | |
| import sys | |
| import base64 | |
| import hashlib | |
| from Crypto import Random | |
| from Crypto.Cipher import AES |
| WITH | |
| t AS ( | |
| -- determine compression flag | |
| SELECT | |
| 'TABLE PARTITION' segment_type, t.table_name segment_name, | |
| t.compression, t.compress_for, | |
| t.partition_name | |
| FROM | |
| user_tab_partitions t | |
| UNION ALL |
| # densify (fill) the missing levels of a data frame | |
| densify = function(d, fill, dimensions, defaults=list()) { | |
| # ensure columns to be filled are factors | |
| dimensions = setdiff(dimensions, fill) | |
| invalid = fill[!sapply(d[fill], is.factor)] | |
| if (length(invalid)) { | |
| stop("Cannot fill non-factors: ", paste0(fill, collapse=', ')) | |
| } |
| #include <TrinketKeyboard.h> | |
| #define BUTTON 0 | |
| #define LED 1 | |
| const unsigned int WINDOW_DELAY = 500; | |
| const unsigned int DEBOUNCE_DELAY = 50; | |
| const unsigned short MAX_PRESS = 4; | |
| unsigned long window_start = 0; |
| """ | |
| Export song list from KBox | |
| """ | |
| import json | |
| import requests | |
| from xml.etree import cElementTree as ElementTree | |
| import csv | |
| # song data tags |