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/env python | |
import distutils.spawn | |
import re | |
import sys | |
if '/usr/local/lib/python2.7/site-packages' not in sys.path: | |
sys.path.insert(0, '/usr/local/lib/python2.7/site-packages') | |
if '/Library/Python/2.7/site-packages' not in sys.path: |
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
[smartcd] | |
recipe = mr.scripty | |
install = | |
... import sys | |
... import os.path | |
... sys.path.insert(0, self.buildout['omelette']['location']) | |
... import pexpect | |
... | |
... script_dir = os.path.join( |
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
Select the runtime to download the base image for: | |
[1] Go | |
[2] Java | |
[3] Python27 | |
[4] All | |
Please enter your numeric choice (4): 3 | |
Pulling base images for runtimes [python27] from Google Cloud Storage | |
Pulling image: google/appengine-python27 | |
Traceback (most recent call last): |
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 webapp2 | |
from functools import wraps | |
from google.appengine.api import memcache | |
def rate_limit(seconds_per_request=1): | |
def rate_limiter(function): | |
@wraps(function) | |
def wrapper(self, *args, **kwargs): | |
added = memcache.add('%s:%s' % (self.__class__.__name__, self.request.remote_addr or ''), 1, |
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
Re-write the following to improve performance (assume the lists below could number into the thousands of elements). | |
list1 = [{'a': 1, 'b': 2}, {'c': 3, 'd': 4}, {'e': 5, 'f': 6}] | |
list2 = [{'e': 5, 'f': 6}, {'g': 7, 'h': 8}, {'i': 9, 'j': 10}] | |
common = [] | |
for entry in list1: | |
if entry in list2: | |
common.append(entry) |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "precise64" | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
config.vm.provision :shell, :inline => "sudo apt-get update; sudo apt-get install -y git-core debconf-utils python-setuptools python-mysqldb; sudo easy_install GitPython" | |
config.vm.define "master" do |master| |
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
appium$ node server.js -V | |
info - socket.io started | |
info: Welcome to Appium v0.6.1 (REV d88a0ea1698db95b40823fb627154bc30c56c61e) | |
info: Appium REST http interface listener started on 0.0.0.0:4723 | |
debug: Appium request initiated at /wd/hub/session | |
debug: Request received with params: {"sessionId":null,"desiredCapabilities":{"name":"MATS","device-ready-timeout":"30","app":"/opt/workspace/xxxx_android_0.0.8-dev-r4074-b1056-prod.apk","platform":"Mac","browserName":"Android","version":"6.0","newCommandTimeout":"1200","device":"Android","app-activity":"com.xxxx.android.activity.LoginScreenActivity","app-package":"com.xxxx.android.root"}} | |
info: Using local app from desiredCaps: /opt/workspace/xxxxx_android_0.0.8-dev-r4074-b1056-prod.apk | |
info: Creating new appium session a957a17e-8f87-4f3a-b68d-958cec83b2f9 | |
info: Starting android appium | |
debug: Using fast reset? true |
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
var io = require('socket.io') | |
var socket = new io.Socket('0.0.0.0', {port: 4723}); | |
if (socket.connect()) { | |
socket.on('message', function(data) { | |
console.log('message', data); | |
}); | |
socket.on('disconnect', function() { | |
console.log('disconnected'); |
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":null,"type":"UIAWindow","label":null,"value":null,"rect":{"origin":{"x":0,"y":0},"size":{"width":768,"height":1024}},"dom":null,"enabled":true,"valid":true,"visible":true,"children":[{"name":"log in","type":"UIAElement","label":null,"value":null,"rect":{"origin":{"x":0,"y":20},"size":{"width":768,"height":1004}},"dom":null,"enabled":true,"valid":true,"visible":true,"children":[{"name":null,"type":"UIAImage","label":null,"value":null,"rect":{"origin":{"x":250,"y":170},"size":{"width":269,"height":279}},"dom":null,"enabled":true,"valid":true,"visible":false,"children":[]},{"name":null,"type":"UIAImage","label":null,"value":null,"rect":{"origin":{"x":203,"y":591},"size":{"width":362,"height":280}},"dom":null,"enabled":true,"valid":true,"visible":false,"children":[]},{"name":"Empty list","type":"UIATableView","label":"Empty list","value":"row 1 of 1","rect":{"origin":{"x":207,"y":595},"size":{"width":354,"height":272}},"dom":null,"enabled":true,"valid":true,"visible":true,"children":[{"name":"Log In Heade |
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 | |
vers = sys.version_info | |
... | |
if vers[0] is 2 and vers[1] is 4: | |
f = open('file.txt', 'r') |