This file contains hidden or 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 eventlet | |
eventlet.monkey_patch() | |
from eventlet.greenpool import GreenPile | |
from kombu.pools import producers | |
from kombu import Exchange, Queue | |
exchange = Exchange('exchange', type='direct') | |
queue = Queue('queue', exchange, routing_key='queue') |
This file contains hidden or 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
export VIRTUAL_ENV_DISABLE_PROMPT=1 | |
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="(" | |
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX=")" | |
function virtualenv_prompt_info() { | |
if [ -n "$VIRTUAL_ENV" ]; then | |
if [ -f "$VIRTUAL_ENV/__name__" ]; then |
This file contains hidden or 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
#!/bin/bash | |
### USAGE | |
### | |
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7 | |
### ./ElasticSearch.sh will fail because no version was specified (exit code 1) | |
### | |
### CLI options Contributed by @janpieper | |
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch |
This file contains hidden or 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 ubuntu:14.04 | |
ENV DEBIAN_FRONTEND noninteractive | |
##///*******************************************************/ | |
##//------------------------ | |
## append apt mirror for ubuntu, update & install | |
##//------------------------ | |
## RUN sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list | |
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list | |
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list | |
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.list |
This file contains hidden or 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
[Unit] | |
Description=Daemon to start Shadowsocks Client | |
Wants=network-online.target | |
After=network.target | |
[Service] | |
Type=simple | |
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks/client.json --pid-file /var/run/sslocal.pid --log-file /var/log/sslocal.log | |
[Install] |
This file contains hidden or 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
all: | |
find . -name '[sS]_[mM]_*' -depth 1 -exec gitbook build {} -o dist/{} \; | |
dirs = $(shell for file in `find . -name '[sS]_[mM]_*' -depth 1`;do echo $$file; done) | |
one: | |
@$(foreach i, $(dirs), cd $(i) && hg pull -u && cd ..;) | |
clean: | |
rm -rf ./dist/* |
This file contains hidden or 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
" copy all this into a vim buffer, save it, then... | |
" source the file by typing :so % | |
" Now the vim buffer acts like a specialized application for mastering vim | |
" There are two queues, Study and Known. Depending how confident you feel | |
" about the item you are currently learning, you can move it down several | |
" positions, all the way to the end of the Study queue, or to the Known | |
" queue. | |
" type ,, (that's comma comma) |
This file contains hidden or 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
#连接rabbitmq服务器 | |
connection = pika.BlockingConnection(pika.ConnectionParameters( | |
host='host')) | |
channel = connection.channel() | |
#定义队列 | |
channel.queue_declare(queue='test_queue') | |
channel.queue_bind(exchange='test_exchange', | |
queue='test_queue', | |
routing_key='test_route_key') | |
This file contains hidden or 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 ids = document.querySelectorAll(".member_id"); | |
var names = document.querySelectorAll(".member_name"); | |
var output = "", length = ids.length; | |
for(var i=0; i<length; i++){ | |
output += ids[i].innerHTML.slice(1,-1) + ":" + names[i].innerHTML + "\n"; | |
} | |
console.log(output); |
This file contains hidden or 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 | |
# -*- coding: utf-8 -*- | |
import sys | |
def crc16(data): | |
if type(data) is tuple: | |
data = list(data) | |
crc_polynom = 0x8408 | |
crc_preset = 0xFFFF |