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 FireAndForgetThreadedHTTPTransport(AsyncTransport, HTTPTransport): | |
| scheme = ['http', 'https', 'faf+http', 'faf+https'] | |
| def send_sync(self, data, headers, success_cb, failure_cb): | |
| try: | |
| super(ThreadedHTTPTransport, self).send(data, headers) | |
| except Exception as e: | |
| failure_cb(e) | |
| else: | |
| success_cb() |
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
| # download: http://ec.europa.eu/eurostat/estat-navtree-portlet-prod/BulkDownloadListing?file=data/migr_resvas.tsv.gz | |
| import gzip | |
| from collections import defaultdict | |
| geo_to_citizen = defaultdict(dict) | |
| for line in gzip.GzipFile("migr_resvas.tsv.gz"): | |
| line = line.decode("utf8") | |
| if not line.startswith("T,TOTAL"): # Ignore non-total lines | |
| continue |
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
| #!/bin/bash | |
| # print the last commit dates of currently existing files in the current repository | |
| ( | |
| git ls-files | sed 's/^/+ /' | |
| git log --format=format:"~ %aI" --name-only . | |
| ) | gawk ' | |
| /^~/ {date=$2;} | |
| /^+/ {extant[$2] = 1;} | |
| /^[^~+]/ {dates[$1] = date;} | |
| END { for (file in dates) if(extant[file]) print(dates[file], file); } |
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
| javascript:!function(){function e(e){var o=Math.random()<.7?"aeiou":"äeiöy";return e.replace(/[aeiouyåäö]+/gi,function(e){var n=o[0|5*Math.random()];return e[0].toUpperCase()==e[0]&&(n=n.toUpperCase()),n})}function o(n){n.nodeType==Node.TEXT_NODE&&/\S/.test(n.nodeValue)?n.nodeValue=e(n.nodeValue):[].slice.call(n.childNodes).map(o)}o(document.body)}(); |
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 urllib import urlencode | |
| import hashlib | |
| import os | |
| import requests | |
| import sys | |
| import tempfile | |
| def build_hash(text, engine, voice, language, fx=None, fx_level=None): | |
| fragments = [ |
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 python3 | |
| # `brew install sox` first | |
| import argparse, tempfile, subprocess, os | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument('-v', '--voice', default='Mikko') | |
| ap.add_argument('-p', '--pitch', type=int, default=0) | |
| ap.add_argument('-t', '--tempo', type=float, default=None) | |
| ap.add_argument('-s', '--speed', type=float, default=None) | |
| ap.add_argument('text') |
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
| akx@monolith:/tmp$ source kkek/bin/activate | |
| (kkek) akx@monolith:/tmp$ UWSGI_EMBED_PLUGINS=stats_pusher_statsd pip install uwsgi | |
| Collecting uwsgi | |
| Using cached uwsgi-2.0.14.tar.gz | |
| Building wheels for collected packages: uwsgi | |
| Running setup.py bdist_wheel for uwsgi ... done | |
| Stored in directory: /home/akx/.cache/pip/wheels/c4/ad/56/f70a70b63fa4b0f2c0518db6f41381c9d33cd5cc5ac9a9494b | |
| Successfully built uwsgi | |
| Installing collected packages: uwsgi | |
| Successfully installed uwsgi-2.0.14 |
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> | |
| <html lang="en"> | |
| <body> | |
| <script> | |
| var canvas = document.createElement('canvas'); | |
| canvas.width = canvas.height = 800; | |
| var ctx = canvas.getContext('2d'); | |
| document.body.appendChild(canvas); | |
| function lerpPoint(pa, pb, alpha) { |
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 shortid = require('shortid'); | |
| const redis = require("redis"); | |
| const client = redis.createClient(); | |
| function t() { | |
| const id = shortid.generate(); | |
| client.sadd('sids', id, (err, res) => { | |
| if(err) throw err; | |
| if(res != 1) { // redis will return the number of new items, so if we added anything other than 1, something broke | |
| throw new Error('gack, duplicate ' + id); |
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
| + #emblem | |
| + #marketing-hero | |
| + #marketing-hero form | |
| + #marketing-hero form .control-label | |
| + #marketing-hero h1 | |
| + #messages | |
| + #messages li | |
| + #messages ul | |
| + #messages.dismissed | |
| + .affix |