Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
# install Nginx | |
sudo apt-get install nginx | |
# install php5.3 and some php modules | |
sudo apt-get install python-software-properties | |
sudo add-apt-repository ppa:ondrej/php5 | |
sudo apt-get update | |
sudo apt-get install -y php5-cgi php5-fpm php5-mysql php5-curl php5-gd php-pear php5-imap php5-mcrypt php5-mhash php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json php5-common php-apc php5-dev | |
# set up Nginx |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
Installation commands:
$ wget http://redis.googlecode.com/files/redis-2.6.7.tar.gz
$ tar xvfz redis-2.6.7.tar.gz
$ cd redis-2.6.7/
$ sudo mkdir -p /opt/redis
$ sudo make PREFIX=/opt/redis install
$ sudo cp redis.conf /opt/redis/redis.conf
$ cd /opt/redis
#! /usr/bin/env python | |
import redis | |
import random | |
import pylibmc | |
import sys | |
r = redis.Redis(host = 'localhost', port = 6389) | |
mc = pylibmc.Client(['localhost:11222']) |
When we compile OpenResty, we would like to have a "good enough" version so that every plugin in our project is installed.
./configure --prefix=/opt/openresty \
--conf-path=/etc/nginx/nginx.conf \
--with-luajit \
def read_producer(text, coroutines): | |
for word in text.split(): | |
for coroutine in coroutines: | |
coroutine.send(word) | |
for coroutine in coroutines: | |
coroutine.close() | |
def match_filter(pattern, next_coroutine): | |
print("Looking for {0}".format(pattern)) |
(by @andrestaltz)
So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).
Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:
Rx.Observable.prototype.flatMapLatest(selector, [thisArg])
Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
package main | |
import ( | |
"net/http" | |
"database/sql" | |
"fmt" | |
"log" | |
"os" | |
) |