Skip to content

Instantly share code, notes, and snippets.

View Ademord's full-sized avatar
🎯
Focusing

Franco Ribera Ademord

🎯
Focusing
  • Zürich, Switzerland
View GitHub Profile
import sys
if sys.version_info[0] == 3:
from io import StringIO
else:
from cStringIO import StringIO
def replace_entities(text, grouped_entities, **replacers):
entities = []
@Ademord
Ademord / ubuntu_agnoster_install.md
Created July 8, 2017 17:34 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 14.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@Ademord
Ademord / ubuntu_agnoster_install.md
Created July 8, 2017 17:34 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 14.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@Ademord
Ademord / SimpleHTTPServerWithUpload.py
Created July 26, 2017 08:44 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@Ademord
Ademord / serialize-numpy-array.py
Created August 7, 2017 11:29 — forked from alexland/serialize-numpy-array.py
serialize, persist, retrieve, and de-serialize a NumPy array as a binary string (any dimension, any dtype); exemplary use case: a web app calculates some result--eg, from a Machine Learning algorithm, using NumPy and the result is a NumPy array; it is efficient to just return that result to rather than persist the array then retrieve it via query
import time
import numpy as NP
from redis import StrictRedis as redis
# a 2D array to serialize
A = 10 * NP.random.randn(10000).reshape(1000, 10)
# flatten the 2D NumPy array and save it as a binary string
array_dtype = str(A.dtype)
@Ademord
Ademord / serialize-numpy-array.py
Created August 7, 2017 11:30 — forked from alexland/serialize-numpy-array.py
serialize, persist, retrieve, and de-serialize a NumPy array as a binary string (any dimension, any dtype); exemplary use case: a web app calculates some result--eg, from a Machine Learning algorithm, using NumPy and the result is a NumPy array; it is efficient to just return that result to rather than persist the array then retrieve it via query
import time
import numpy as NP
from redis import StrictRedis as redis
# a 2D array to serialize
A = 10 * NP.random.randn(10000).reshape(1000, 10)
# flatten the 2D NumPy array and save it as a binary string
array_dtype = str(A.dtype)