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
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:5d88cc5ee3abf75f4705adfae917ca4a4fa214cbf4a09025e81166a248935557" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
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
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:d82c6f4443637d378cccfa9275c1931d1f275b7f69d91ed29aadd8575137b2b8" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
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 joblib import Parallel, delayed | |
import numpy as np | |
N = 1000 | |
def big_fucking_computation(dir): | |
# do something with dir.. | |
# this should take some time.. | |
return np.random.random((784, N)) |
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 division, print_function | |
from string import maketrans | |
import re | |
def thue_morse(n): | |
comp = maketrans('01', '10') | |
s = '0' | |
for _ in range(n): | |
s += s.translate(comp) |
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
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:ef7ca5a14e7a01867f1d77880a532e12f70a22d5dc580b53ccfce1ba360ba3d1" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
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
# iframe_stack: list of iframe_data's | |
# iframe_data: iframe_domain + list of js_domain's | |
iframe_stack = [] | |
for iframe_url, js_urls in impression['ac_iframedata']: | |
iframe_domain = select_or_insert_id('domain', get_domain(iframe_url)) | |
js_domains = [select_or_insert_id('domain', get_domain(js_url)) for js_url in js_urls] | |
iframe_stack.append((iframe_domain, js_domains)) | |
iframe_datas = [] |
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
ad_source_id = 0 | |
cs = [('ad_image_domain', imp['ac_bannerhost']), | |
('iframe_domain', data_rec['iframe_domain']), | |
('ad_image_linked_domain', imp['ac_clickhost'])] | |
cs += [('iframe_domain', iframe_dom) | |
for iframe_dom, _, _ in iframe_stack] | |
for company_table, company_value in cs: | |
q = """select company from {} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 random | |
from hashlib import md5, sha1 | |
from collections import defaultdict | |
from scipy.stats import hmean | |
import numpy as np | |
import redis | |
import sys | |
def get_n_zeros(v, n_bits=128, from_right=True): | |
"""Get number of trailing or leading 0s in the binary |