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
CXX:=g++ | |
SOURCE:=local-global-snake.cpp \ | |
snake.cpp \ | |
image-process.cpp | |
PROJECT_NAME:=local-global-snake | |
SOURCE_DIR:=source | |
RELEASE_DIR:=release | |
DEBUG_DIR:=debug |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import fcntl | |
from functools import wraps | |
import os | |
def singleton(pid_filename): | |
def decorator(f): |
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 functools import wraps | |
import threading | |
import types | |
lock = threading.Lock() | |
def method_lock(f): | |
@wraps(f) | |
def decorator(*args, **kwargs): | |
lock.acquire() |
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
while True: | |
if result.job_status in ['started', 'queued']: | |
sleep(result.sleep) | |
continue | |
elif result.vehicle_status == 'ok': | |
process_violation(result.violations) | |
break | |
elif result.vehicle_status == 'error': | |
# vehicle info error | |
break |
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
int_arr = [97, 98, 99, 100, 101] | |
char_arr = ''.join([unichr(i) for i in int_arr]) |
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 diffbot import Client | |
c = Client('demo_token') | |
url = 'http://www.diffbot.com/products/automatic/article/' | |
json_object = c.get('/v2/article', url) | |
data = 'Now is the time for all good robots to come to the aid of their-- oh never mind, run!' | |
json_object = c.post('/v2/article', url, content_type='text-plain', data=data) |
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 flask import Flask, request, make_response | |
from thrift.protocol import TBinaryProtocol | |
from thrift.server import TServer | |
from thrift.transport import TTransport | |
from FooService import FooService | |
from foo_service_handler import FooServiceHandler | |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import requests | |
# api = 'https://api.xmpush.xiaomi.com/v2/message/regid' | |
api = 'https://sandbox.xmpush.xiaomi.com/v2/message/regid' | |
secret = 'demo_secret' |
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 | |
template = """ | |
def test_%s(): | |
pass | |
""" | |
def main(): |
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
<?php | |
$app_key = 'demo_key'; | |
$app_secret = 'demo_secret'; | |
$rfc_1123_date = gmdate('D, d M Y H:i:s T', time()); | |
file_put_contents('./log.txt',json_encode($_POST),FILE_APPEND); | |
// $_POST['job_id'] ='577c460f-140a-4112-8898-a943ea020ccc'; | |
if(isset($_POST['job_id'])){ |
OlderNewer