Skip to content

Instantly share code, notes, and snippets.

View rkempter's full-sized avatar

Renato Kempter rkempter

  • Lausanne, Switzerland
View GitHub Profile
@rkempter
rkempter / install_ec2.sh
Last active February 16, 2016 10:05 — forked from arttuladhar/install_ec2.sh
Installing tmux on EC2
# Installing tmux on Amazon-EC2
# If you don't have libevent install use wget to install the libevent and install
wget https://github.com/downloads/libevent/libevent/libevent-2.0.18-stable.tar.gz
tar zxf libevent-2.0.18-stable.tar.gz
cd libevent-2.0.18-stable && sudo ./configure && sudo make install
# If you don't have curses install use yum to install the curses
@rkempter
rkempter / Line sampling
Created March 5, 2015 15:48
Sampling from a file through shell
awk 'BEGIN {srand()} !/^$/ { if (rand() <= .5) print $0}'
@rkempter
rkempter / top N artists lists with spark
Created February 20, 2015 13:55
Generate top N lists for each user
from pyspark import SparkContext
from heapq import heappush, heappop
import re
logFilePath = '/Users/rkempter/Downloads/lastfm-dataset-1K/userid-timestamp-artid-artname-traid-traname.tsv'
def get_top_N_artists(tuple, top_N=10):
"""
Returns the top N artists
"""
@rkempter
rkempter / gist:5194885
Created March 19, 2013 09:55
Symfony 2 change language of current route
<ul class="lang-menu">
<li><a href="{{ path(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale': 'ca'})) }}">Català</a></li>
<li><a href="{{ path(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale': 'en'}))}}">English</a></li>
</ul>