This file contains 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
import socket | |
import asyncio | |
import websockets | |
import time | |
import logging | |
import argparse | |
import threading | |
import sys | |
This file contains 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 | |
OPENSSL_VERSION="1.0.1g" | |
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz | |
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz | |
mv openssl-$OPENSSL_VERSION openssl_i386 | |
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz | |
mv openssl-$OPENSSL_VERSION openssl_x86_64 | |
cd openssl_i386 |
This file contains 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
#include <cmath> | |
#include <assert.h> | |
#include <core/TestPattern.h> | |
TestPattern::TestPattern() | |
:w(0) | |
,h(0) | |
,frame_num(0) | |
,duration(0) |
This file contains 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
import argparse | |
import av | |
import logging | |
import time | |
def parse_options(preset, tune, crf, x264_params, x265_params): | |
opts = {} | |
if preset: | |
opts['preset'] = preset |
This file contains 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
// Computes the SHA-256 digest of a string with Web Crypto | |
// Source: https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest | |
function sha256(str) { | |
// Get the string as arraybuffer. | |
var buffer = new TextEncoder("utf-8").encode(str) | |
return crypto.subtle.digest("SHA-256", buffer).then(function(hash) { | |
return hex(hash) | |
}) | |
} |
This file contains 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
import json | |
import random | |
import string | |
from functools import partial | |
from sanic import Sanic | |
import aioredis | |
import asyncio | |
import websockets |
This file contains 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
# -*- coding: utf-8 -*- | |
# | |
# Used like this: | |
# | |
# from repermute import ipermute | |
# | |
# for s in ipermute('[A-Z]\d'): | |
# print s | |
# | |
# Almost all regular expression constructs are supported except for '*' |
This file contains 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: https://github.com/darius/sketchbook/blob/master/regex/integrated1.py | |
Integrate the right-to-left top-down operator-precedence parser with | |
the simplest terminating NFA code. | |
""" | |
def match(re, s): return run(prepare(re), s) | |
def run(states, s): |
This file contains 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 __future__ import print_function | |
import json | |
import os | |
import numpy as np | |
from gensim.models import Word2Vec | |
from gensim.utils import simple_preprocess | |
from keras.engine import Input | |
from keras.layers import Embedding, merge |
This file contains 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
import numpy as np | |
import matplotlib.pyplot as plt | |
import seaborn as sns # improves plot aesthetics | |
def _invert(x, limits): | |
"""inverts a value x on a scale from | |
limits[0] to limits[1]""" | |
return limits[1] - (x - limits[0]) | |
def _scale_data(data, ranges): |
NewerOlder