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 argparse | |
import json | |
import subprocess | |
from collections import namedtuple | |
def execute(arg, cwd): | |
proc = subprocess.Popen( | |
arg, | |
shell=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
{ | |
"title": "nekoya", | |
"rules": [ | |
{ | |
"description": "backslash", | |
"manipulators": [ | |
{ | |
"conditions": [{"input_sources": [{"language": "en"}], "type": "input_source_if"}], | |
"from": {"key_code": "international3"}, | |
"to": [{"key_code": "international3", "modifiers": "option"}], |
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 github import Github | |
GITHUB_TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
g = Github(GITHUB_TOKEN) | |
def get_user(): | |
""" | |
Returns: |
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
redis-server --port 6381 --cluster-enabled yes --cluster-config-file ~/rediscluster/nodes1.conf | |
redis-server --port 6382 --cluster-enabled yes --cluster-config-file ~/rediscluster/nodes2.conf | |
redis-server --port 6383 --cluster-enabled yes --cluster-config-file ~/rediscluster/nodes3.conf |
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 subprocess | |
import sys | |
import time | |
p = subprocess.Popen( | |
('redis-server', '--port', '6379', '--bind', '127.0.0.1'), | |
stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE) | |
WAIT = 0.001 |
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 benchmarker import Benchmarker | |
import json | |
import ujson | |
imp_obj = { | |
'rectangle': {'tagid': '12345', 'banner': {'w': 300, 'h': 250}}, | |
'big_banner': {'tagid': '22222', 'banner': {'w': 728, 'h': 90}}, | |
'rectangle_with_inventory': {'tagid': '10000', 'banner': {'w': 300, 'h': 250}}, | |
'banned': {'tagid': '54321', 'banner': {'w': 300, 'h': 250}}, | |
} |
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 benchmarker import Benchmarker | |
from itertools import ifilter | |
f = lambda x: x % 2 | |
with Benchmarker(width=40, loop=1000) as bm: | |
for _ in bm('filter'): | |
list(filter(f, xrange(10000))) | |
for _ in bm('ifilter'): | |
list(ifilter(f, xrange(10000))) |
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
if [ ! -f /etc/init.d/jenkins ];then | |
curl -L http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - | |
echo "deb http://pkg.jenkins-ci.org/debian binary/" > /etc/apt/sources.list.d/jenkins.list | |
apt-get -y update | |
apt-get install -y jenkins | |
# wait jenkins http port | |
echo "wait Jenkins service " | |
while [ "`netstat -tunl|grep 8080`" = "" ];do echo -n "."; sleep 1; done | |
echo " ok" |
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
# -*- coding: utf-8 -*- | |
import argparse | |
import re | |
import sys | |
from collections import namedtuple | |
import git | |
match_serial = re.compile(r'^\+\s+(\d{10})\s*; serial$').match |
NewerOlder