$ sudo -u postgres psql
postgres=# CREATE ROLE foouser WITH LOGIN PASSWORD '************';
#!/usr/bin/env groovy | |
/* | |
Generates a template for journal (for a single month). | |
Example: | |
Journal 2013/11 |
def gandalf(func): | |
def inner(*args, **kwargs): | |
raise ValueError("You shall not pass!") | |
return func(*args, **kwargs) | |
return inner | |
@gandalf | |
def balrog(): | |
pass |
#!/usr/bin/env python | |
# ByteBeats - byte-level procedural music | |
# | |
# Source: Jamey at Royal Paw | |
# http://royal-paw.com/2012/01/bytebeats-in-c-and-python-generative-symphonies-from-extremely-small-programs/ | |
# | |
# Adapted to run in a single script. | |
# | |
# run as: | |
# $ python bytebeats.py 0 | sox -r 8000 -b 8 -c 1 -t raw -e signed-integer - -d |
import socket | |
def netcat(hostname, port): | |
""" | |
Reads lines from a network socket and prints them to standard output. | |
Similar to: netcat $HOST $PORT. | |
""" | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect((hostname, port)) | |
socket_file = s.makefile() |
import zmq | |
import time | |
context = zmq.Context() | |
socket = context.socket(zmq.PUB) | |
socket.connect("tcp://127.0.0.1:5556") | |
# Sleep a bit of time until the connection is properly established, | |
# otherwise some messages may be lost. | |
# http://stackoverflow.com/questions/7470472/lost-messages-on-zeromq-pub-sub |
# https://spark.apache.org/downloads.html | |
# https://spark.apache.org/docs/latest/ | |
# download | |
wget http://d3kbcqa49mib13.cloudfront.net/spark-2.0.0-bin-hadoop2.7.tgz | |
# verify the checksum | |
curl http://www.apache.org/dist/spark/spark-2.0.0/spark-2.0.0-bin-hadoop2.7.tgz.md5 | |
md5sum spark-2.0.0-bin-hadoop2.7.tgz |
import matplotlib as mpl | |
mpl.use('Agg') | |
import matplotlib.pyplot as plt | |
import moviepy.editor as mpy | |
from moviepy.video.io.bindings import mplfig_to_npimage | |
import numpy as np | |
from scipy.signal import medfilt | |
import tfr | |
# --- parameters --- |
import matplotlib as mpl | |
mpl.use('Agg') | |
import matplotlib.pyplot as plt | |
import moviepy.editor as mpy | |
from moviepy.video.io.bindings import mplfig_to_npimage | |
import numpy as np | |
from scipy.signal import medfilt | |
import tfr | |
# --- parameters --- |