View gist:915227
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
# multi_accept on; | |
} |
View gunicorn.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is a wrapper around gunicorn | |
# It provides clean interface for starting stopping app server | |
PROJECT_NAME=photon | |
HOME_DIR=/home/photon | |
RELEASE_DIR=$HOME_DIR/releases/current | |
GUNICORN_BIN=$HOME_DIR/bin/gunicorn_django | |
GUNICORN_PID=$HOME_DIR/pids/gunicorn.pid |
View lab7.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
def fib_gen(): | |
a, b = 1, 1 | |
while True: | |
yield a | |
a, b = b, a+b | |
def get_values(iterator, n): | |
l = [] | |
for i in range(n): |
View lab7.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
def fib_gen(): | |
a, b = 1, 1 | |
while True: | |
yield a | |
a, b = b, a+b | |
def get_values(iterator, n): | |
l = [] | |
for i in range(n): |
View registry.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
""" | |
Dependency injection made simple | |
@requires('stores') | |
class Action(object): | |
self.stores = None | |
@provides('stores') | |
class InMemoryStores(Stores): |
View models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(cascade) % ./manage.py syncdb | |
Creating tables ... | |
Creating table ticket_a | |
Creating table ticket_b | |
Creating table ticket_c | |
Installing custom SQL ... | |
Installing indexes ... | |
No fixtures found. | |
(cascade) % ./manage.py shell | |
Python 2.7.2 (default, Jan 17 2012, 23:42:54) |
View utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def render_dict(pattern, data): | |
"""Render Django model to dict (helps in rendering JSON)""" | |
out = {} | |
for item in pattern: | |
if isinstance(item, basestring): | |
attr = manager_getattr(data, item) | |
out[item] = attr | |
elif isinstance(item, dict): | |
for subitem, subpattern in item.items(): | |
attr = manager_getattr(data, subitem) |
View gchat.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gchat | |
import "log" | |
import "net" | |
import "bufio" | |
import "fmt" | |
func Serve() { | |
fmt.Println("Start server on port 2000") | |
l, err := net.Listen("tcp", ":2000") |
View output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TASK: [debug msg="/home/$user/13-02-17--15-23-58"] ********************* | |
ok: [192.168.60.2] | |
TASK: [pause seconds=5] ********************* | |
(^C-c = continue early, ^C-a = abort) | |
[192.168.60.2] | |
Pausing for 5 seconds | |
ok: [192.168.60.2] | |
TASK: [debug msg="/home/$user/13-02-17--15-24-04"] ********************* |
View output-bad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TASK: [aasdfasds] ********************* | |
ok: [192.168.60.2] => {"msg": "$home/13-02-17--19-36-28"} | |
TASK: [pause seconds=2] ********************* | |
(^C-c = continue early, ^C-a = abort) | |
[192.168.60.2] | |
Pausing for 2 seconds | |
ok: [192.168.60.2] => {"changed": false, "delta": 2, "rc": 0, "start": "2013-02-17 19:36:28.635563", "stderr": "", "stdout": "Paused for 2.0 seconds", "stop": "2013-02-17 19:36:30.635935"} | |
TASK: [aasdfasd] ********************* |
OlderNewer