Skip to content

Instantly share code, notes, and snippets.

# 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
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@arivero
arivero / .bashrc
Created February 1, 2019 16:36 — forked from mGalarnyk/.bashrc
Function to append to the end of .bashrc file in linux to run PySpark on jupyter notebook for the blog post https://medium.com/@GalarnykMichael/install-spark-on-ubuntu-pyspark-231c45677de0#.qxguj5czj
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
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):
@arivero
arivero / embeddings_and_convs.py
Created February 23, 2018 15:23 — forked from pekaalto/embeddings_and_convs.py
Example of two equivalent methods of embedding categorical features on channel dimension
"""
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:
@arivero
arivero / PutBacks.sh
Created October 10, 2017 23:37
CGI para detectar e insertar citas a las paginas web
#!/bin/sh
######################################################################
# Nombre: PutBacks
# Descripcion: CGI para detectar e insertar citas a las paginas web
# Author: Alejandro Rivero (rivero@sol.unizar.es)
# 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
@arivero
arivero / Dualities.tex
Created August 18, 2017 12:22
M theory superstring dualities, tikz graph for latex
\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) {};
@arivero
arivero / telegram_alarm.py
Last active October 12, 2016 23:51
pokemon notification bot for Telegram/pkalarm somehow extended
#Setup Logging
import logging
log = logging.getLogger(__name__)
#Python modules
import io
import json
#Local modules
from ..alarm import Alarm
@arivero
arivero / borrador.py
Last active July 8, 2016 13:42
elecciones 2016
# 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
@arivero
arivero / podemosPrimariasGene
Created July 24, 2015 18:00
resumen por euipos de las primarias de podemos a las generales
Equipo PABLO IGLESIAS
1.- Íñigo Errejón Galván (45122 votos, 76.12%)
2.- Carolina Bescansa (42901 votos, 72.37%)
...
61.- Mª Dolores Marín-Albo Montes (35989 votos, 60.71%)
68.- Arnau Mallol I Baró (35685 votos, 60.2%)
UTOPIA Y DIGNIDAD