Skip to content

Instantly share code, notes, and snippets.

@z-lite
z-lite / tornado_asyncio.py
Created April 20, 2016 03:53 — forked from drgarcia1986/tornado_asyncio.py
Tornado and Asyncio Mixed example
# -*- coding: utf-8 -*-
import asyncio
import re
import asyncio_redis
import tornado.concurrent
import tornado.httpclient
import tornado.web
import tornado.platform.asyncio
@z-lite
z-lite / docker-gnatsd-cluster.org
Created October 12, 2015 09:30 — forked from wallyqs/docker-gnatsd-cluster.org
Docker GNATSD Cluster example

Docker GNATSD Cluster example

Below is an example of how to setup gnatsd cluster using Docker.

I have put 3 different configurations (one per gnatsd server) under a folder named conf as follows:

tree conf
@z-lite
z-lite / cloud-config-master-node.yaml
Last active September 16, 2015 11:49 — forked from noonien/cloud-config-master-node.yaml
k8s v0.15.0 on CoreOS
#cloud-config
hostname: node-01
ssh_authorized_keys:
- ssh-rsa <redacted>
coreos:
etcd2:
discovery: https://discovery.etcd.io/<redacted>
advertise-client-urls: http://node-01.mux.lan:2379
# use with: logging.config.dictConfig(yaml.load(open('logging.yaml', 'r')))
# Formatters detailed here: http://docs.python.org/2/library/logging.html#logrecord-attributes
version: 1
formatters:
simple:
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
detail:
format: '%(asctime)s - %(levelname)s - File: %(filename)s - %(funcName)s() - Line: %(lineno)d - %(message)s'
'''
This is a module that defines some helper classes and functions for
expiring groups of related keys at the same time.
Written July 1-2, 2013 by Josiah Carlson
Released into the public domain
'''
import time
from concurrent.futures import ThreadPoolExecutor
from functools import partial, wraps
import time
import tornado.ioloop
import tornado.web
EXECUTOR = ThreadPoolExecutor(max_workers=4)

Ruby in 100 Minutes

About Ruby

Ruby was written to make the programmer's job easy and not care if the computer's job is hard. In this brief introduction we'll look at the key language features you need to get started.

Key Language features

  1. Instructions and Interpreters
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Examples from http://andreypopp.com/posts/2012-10-30-callbacks-to-promises.html
# using IcedCoffeeScript http://maxtaco.github.com/coffee-script/ :
search = (engine, q, cb) ->
$.ajax(url: engine, success: cb)
await
search 'google', 'js', defer(googleSearched)
search 'bing', 'js', defer(bingSearched)
processResults(bingSearched, googleSearched)
await