This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let hasBlobConstructor = typeof(Blob) !== 'undefined' && (function () { | |
| try { | |
| return Boolean(new Blob()); | |
| } catch (e) { | |
| return false; | |
| } | |
| }()); | |
| let hasArrayBufferViewSupport = hasBlobConstructor && typeof(Uint8Array) !== 'undefined' && (function () { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from tornado import web, ioloop, escape | |
| import hmac, hashlib | |
| SECRET = 'jGW7UPn8T1kpuNP1Op79YIL4Th4a5Cduebgta4riFE2zcAWAmhZToDmevmr4iLfO' | |
| def constant_time_compare(val1, val2): | |
| """ | |
| Returns True if the two strings are equal, False otherwise. | |
| The time taken is independent of the number of characters that match. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <head> | |
| <script> | |
| var start_indicator = 'START'; | |
| var lineNum = 0; | |
| var render = function(newData) { | |
| var content = ''; | |
| newData = newData.replace(/^\s+|\s+$/g, ''); | |
| if (newData === '') return ''; | |
| var lines = newData.split('\\n'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "http-exec", | |
| "version": "1.0.0", | |
| "description": "Command Execution Server", | |
| "main": "server.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1", | |
| "start": "node server.js" | |
| }, | |
| "author": "David Collien", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Multipart = { | |
| parse: (function() { | |
| function Parser(arraybuf, boundary) { | |
| this.array = arraybuf; | |
| this.token = null; | |
| this.current = null; | |
| this.i = 0; | |
| this.boundary = boundary; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ContrastTools = { | |
| relLuminance(rgba) { | |
| // http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef | |
| var rgb = rgba.slice(); | |
| for (var i = 0; i < 3; i++) { | |
| var channel = rgb[i] / 255; | |
| rgb[i] = channel < .03928 ? channel / 12.92 : Math.pow((channel + .055) / 1.055, 2.4); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import pyrax | |
| pyrax.set_setting('identity_type', 'rackspace') | |
| pyrax.set_credentials(RACKSPACE_API_USER, RACKSPACE_API_KEY, region='SYD') | |
| def server_list_generator(detailed=True, search_opts=None, limit=None): | |
| servers = pyrax.cloudservers.servers.list(detailed=detailed, | |
| search_opts=search_opts, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| infinity = float("inf") | |
| def argmin(seq, fn): | |
| """Return an element with lowest fn(seq[i]) score; tie goes to first one. | |
| >>> argmin(['one', 'to', 'three'], len) | |
| 'to' | |
| """ | |
| best = seq[0]; best_score = fn(best) | |
| for x in seq: | |
| x_score = fn(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const WebSocket = require('ws'); | |
| const PythonShell = require('python-shell'); | |
| const tmp = require('tmp'); | |
| const shortid = require('shortid'); | |
| const fs = require('fs'); | |
| const mkdirp = require('mkdirp'); | |
| // TODO clean up code, error handling, watchdog timer | |
| const wss = new WebSocket.Server({ port: 8080 }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Config(object): | |
| def __init__(self, **entries): | |
| self.__dict__.update(entries) | |
| self._entries = entries | |
| def __repr__(self): | |
| return "Config(%s)" % str(self._entries) | |
| def __getattr__(self, value): | |
| return None |