Skip to content

Instantly share code, notes, and snippets.

View syshen's full-sized avatar

Steven Shen syshen

View GitHub Profile
import sys
import os
import urllib
base_url = "https://maps.googleapis.com/maps/api/place/search/json?location=25.042582,121.513936&radius=500&types=sublocality&sensor=false&key=AIzaSyBhIVUcucpsBPyHvJYu-e29Pewpj953dWM"
resp = urllib.urlopen(base_url)
print resp.read()
{
"html_attributions" : [],
"results" : [
{
"geometry" : {
"location" : {
"lat" : 25.04498590,
"lng" : 121.51059250
},
"viewport" : {
import sys, os
import cv
def detectObject(image):
size = cv.GetSize(image)
grayscale = cv.CreateImage(size, 8, 1)
cv.CvtColor(image, grayscale, cv.CV_BGR2GRAY)
storage = cv.CreateMemStorage(0)
cv.EqualizeHist(grayscale, grayscale)
cascade = cv.Load("haarcascade_frontalface_alt.xml")
import urllib
import httplib
import json
import time
import zlib
email = '[email protected]'
password = 'abcdef'
apikey = 'e965434a-3ed5-540a-9ef2-1f8ce1dc60f2'
start on runlevel[12345]
stop on runlevel[06]
respawn
ulimit -n 65535
if [ -d /usr/lib/node_modules ] ; then
export NODE_PATH='/usr/lib/node_modules'
else
export NODE_PATH='/usr/local/lib/node_modules'
fi
set mailserver email-smtp.us-east-1.amazonaws.com port 465
username "XXXXXXXXXXXXXXXXXX" password "XXXXXXXXXXXXXXXX"
using sslv3 with timeout 15 seconds using hostname xxxx.example.com
set mail-format {
from: [email protected]
subject: $SERVICE $EVENT at $DATE on $HOST
message: Alert from $HOST
Date: $DATE
For $SERVICE ($EVENT) and take $ACTION
---------------------------------------
set :repository, "[email protected]:your_project/your_git.git"
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "github.pem")]
set :scm, "git"
set :git_enable_submodules, 1
set :scm_verbose, false
set :deploy_to, "/home/code/"
task :develop do
set :branch, "release"
set :target, "dev.yourweb.com"
role :web, "dev.yourweb.com"
role :worker, "dev.yourweb.com"
role :scheduler, "dev.yourweb.com"
role :batch, "dev.yourweb.com"
end
task :staging do
require 'rubygems'
require 'action_mailer'
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:tls => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
namespace :deploy do
task :default do
transaction do
deploy.git_log
deploy.update
deploy.setup
deploy.restart
end
end