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
import sys | |
from PIL import Image, ImageDraw | |
try: | |
import cv | |
except ImportError: | |
print 'Could not import cv, trying opencv' | |
import opencv.cv as cv |
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
try: | |
import pika | |
from pika.adapters.tornado_connection import TornadoConnection | |
except ImportError: | |
pika = None | |
try: | |
import tornado | |
import tornado.ioloop | |
except ImportError: |
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
-- | |
- name: Create DNS zone | |
route53_zone: | |
zone: "{{ item }}.{{ domain }}" | |
state: present | |
comment: Created with Ansible | |
with_items: "{{ dns_zone_namespaces }}" | |
register: dns_zones |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 first_value(l): | |
for (value, time) in l: | |
if value is not None: | |
return value |
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
first_value([[null,Time]|T]) -> | |
first_value(T); | |
first_value([[Value, Time]|T]) -> | |
{ok, Value}; | |
first_value(_)-> | |
{error, no_value}. |
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
[[null,1378153440], | |
[1.0,1378153380], | |
[1.0|...], | |
[...]|...] |
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 post_worker_init(worker): | |
env = { | |
'REQUEST_METHOD': 'GET', | |
'PATH_INFO': '/_status', | |
} | |
def start_response(*args, **kwargs): | |
_send_udp(args[0]) | |
worker.wsgi(env, start_response) |
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
from werkzeug.wrappers import Request, Response | |
@Request.application | |
def application(request): | |
resp = Response('Hello World!') | |
if request.path == '/_status': | |
resp.status = '200 OK' | |
else: | |
resp.status ='404 Not Found' | |
return resp |
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
import socket | |
import time | |
def post_worker_init(worker): | |
_send_udp('200 OK\n') | |
def _send_udp(message): | |
udp_ip = "127.0.0.1" | |
udp_port = 4012 |
NewerOlder