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
import hashlib | |
import timeit | |
def slow(z,f,i): | |
s=hashlib.sha3_512(i.to_bytes(8,'big')) | |
for x in range(z): s.update(s.digest()*f) | |
return s.digest() | |
initcode=""" | |
import concurrent.futures | |
from functools import partial | |
executorT = concurrent.futures.ThreadPoolExecutor() |
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
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
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
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end |
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
function snotebook () | |
{ | |
#Spark path (based on your computer) | |
SPARK_PATH=~/spark-2.0.0-bin-hadoop2.7 | |
export PYSPARK_DRIVER_PYTHON="jupyter" | |
export PYSPARK_DRIVER_PYTHON_OPTS="notebook" | |
# For python 3 users, you have to add the line below or you will get an error | |
#export PYSPARK_PYTHON=python3 |
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
import numpy as np | |
from sklearn.datasets import make_moons | |
from sklearn.cross_validation import train_test_split | |
n_feature = 2 | |
n_class = 2 | |
def make_network(n_hidden=100): |
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
""" | |
Pekka Aalto 2017 | |
This snippet tries to explain by example what deepmind means | |
in https://arxiv.org/abs/1708.04782 | |
about embedding on channel axis being equivalent to | |
one-hot-encoding followed by 1x1 conv. | |
They write: |
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/sh | |
###################################################################### | |
# Nombre: PutBacks | |
# Descripcion: CGI para detectar e insertar citas a las paginas web | |
# Author: Alejandro Rivero ([email protected]) | |
# Date: noviembre 1996 | |
########################################################################## | |
# Usage: | |
# With CERN httpd (3.0 or near) add to the config file some lines | |
# indicating the directories to monitorize for backlinks |
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
\usetikzlibrary{arrows} | |
\begin{tikzpicture} | |
\node (v1) at (-4,3) {IIA}; | |
\node (v2) at (-4,-1) {IIB}; | |
\node (v4) at (0.5,0) {I}; | |
\node (v6) at (4.5,-1) {$H_{32}$}; | |
\node (v3) at (0.5,2) {I'}; | |
\node (v5) at (4.5,3) {$H_{E\times E}$}; | |
\node (v8) at (-7,-0.5) {}; |
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
#Setup Logging | |
import logging | |
log = logging.getLogger(__name__) | |
#Python modules | |
import io | |
import json | |
#Local modules | |
from ..alarm import Alarm |
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
# coding: utf-8 | |
# In[1]: | |
f=open("test.json") | |
# In[2]: | |
import json | |
from collections import OrderedDict | |
# In[3]: | |
j=json.load(f,object_pairs_hook=OrderedDict) | |
# In[8]: | |
from collections import Counter,defaultdict |