Skip to content

Instantly share code, notes, and snippets.

@roles('broker', 'stressors')
def git_pull():
with cd("%s" % git_folder):
run("git pull")
@roles('stressors')
def restart_celeryd():
# NOT WORKING
sudo("supervisorctl restart all")
<?php
$countryArray = array(
'AD'=>array('name'=>'ANDORRA','code'=>'376'),
'AE'=>array('name'=>'UNITED ARAB EMIRATES','code'=>'971'),
'AF'=>array('name'=>'AFGHANISTAN','code'=>'93'),
'AG'=>array('name'=>'ANTIGUA AND BARBUDA','code'=>'1268'),
'AI'=>array('name'=>'ANGUILLA','code'=>'1264'),
'AL'=>array('name'=>'ALBANIA','code'=>'355'),
'AM'=>array('name'=>'ARMENIA','code'=>'374'),
'AN'=>array('name'=>'NETHERLANDS ANTILLES','code'=>'599'),
We need a better syntax for routing. The dispatch list
is both too limited and too inconvenient.
This better syntax will be parsed and converted to a more
efficient form before it is used, therefore the complexity
of the parsing of the routes has no impact on performance.
We accept both strings and binaries.
First we can match normal paths.

The introduction to Reactive Programming you've been missing

(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.

@gene9
gene9 / main.py
Created July 10, 2014 16:14 — forked from fogleman/main.py
Collision detection
from collections import deque
from math import sin, cos, pi, atan2, hypot
import random
import time
import wx
SIZE = 600
COUNT = 64
SPEED = 100
FOLLOWERS = 4
# Note that target_env.login and target_env.password is global variables
# Maybe I should add this into Fabric project (http://docs.fabfile.org/en/1.4.2/index.html).
# This is complicated task for sure but it would be nice if Fabric could use ssh under Linux and PowerShell Remoting under Windows.
def remote_sh(target_host, command_text, ignore_error=False):
print('run PowerShell script block at {0}: {1}'.format(target_host, command_text))
command_text = command_text.replace('"', '\'')
import sys
import time
import subprocess
import types
from tempfile import TemporaryFile
def remote_sh(target_host, login, password, command_text, stdout=None, stderr=None):
winrs_text = 'winrs -remote:{0} -username:{1} -password:{2} -noprofile {3}'.format(
target_host, login, password, command_text)
#print('winrs text: {0}\n'.format(winrs_text))
@gene9
gene9 / tree.py
Created May 16, 2014 20:14 — forked from benselme/tree.py
# -*- encoding: utf-8 -*-
from sqlalchemy import (Column, Integer, ForeignKey, String, create_engine,
literal, null)
from sqlalchemy.dialects.postgresql import array
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session, aliased
Base = declarative_base()
using System.IO;
using System;
using System.ComponentModel;
class Program
{
public int? NullableProperty { get; set; }
static void Main(string[] args)
{
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2013 Peter Steinberger. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.