Skip to content

Instantly share code, notes, and snippets.


Renato Kempter rkempter

  • Lausanne, Switzerland
View GitHub Profile
rkempter /
Last active Feb 16, 2016 — forked from arttuladhar/
Installing tmux on EC2
# Installing tmux on Amazon-EC2
# If you don't have libevent install use wget to install the libevent and install
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 / Line sampling
Created Mar 5, 2015
Sampling from a file through shell
View Line sampling
awk 'BEGIN {srand()} !/^$/ { if (rand() <= .5) print $0}'
rkempter / top N artists lists with spark
Created Feb 20, 2015
Generate top N lists for each user
View top N artists lists with spark
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 / gist:5194885
Created Mar 19, 2013
Symfony 2 change language of current route
View gist:5194885
<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>