Skip to content

Instantly share code, notes, and snippets.

using System.IO;
using System;
using System.ComponentModel;
class Program
{
public int? NullableProperty { get; set; }
static void Main(string[] args)
{
@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()
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))
# 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('"', '\'')
@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

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.

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.
@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")
@gene9
gene9 / forms.html
Last active August 29, 2015 14:06 — forked from gnunicorn/forms.html
{%- macro form_field_label(field) -%}
<label for="{{ field.id }}">{{ field.label.text }}
{%- if field.flags.required -%}
<abbr title="Diese Feld muss angegeben werden">*</abbr>
{%- endif %}</label>
{% endmacro %}
{%- macro form_field_description(field) -%}
{% if field.description %}
<span class="descr">{{ field.description }}</span>

Hey! I saw this has been indexed by the search engines. It is a first draft of a post I ended up publishing on my blog at: Scaling PostgreSQL With Pgpool and PgBouncer

Thanks for stopping by!

PostgreSQL and Pgpool Architecture