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/env python | |
import urllib2 | |
from multiprocessing.dummy import Pool as ThreadPool | |
import redis | |
hosts_d = { | |
"host1": [6360, 6361, 6362, 6363], |
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/env python | |
import urllib2, httplib | |
handler=urllib2.HTTPHandler(debuglevel=1) | |
opener = urllib2.build_opener(handler) | |
urllib2.install_opener(opener) | |
url = "http://www.baidu.com" | |
print urllib2.urlopen(url).read()[:10] |
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/sh | |
# create self-signed server certificate: | |
read -p "Enter your domain [www.example.com]: " DOMAIN | |
echo "Create server key..." | |
openssl genrsa -des3 -out $DOMAIN.key 1024 |
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 threading | |
import urllib2 | |
import time, random | |
class GrabUrl(threading.Thread): | |
def __init__(self, arg0): | |
threading.Thread.__init__(self) | |
self.host=arg0 | |
def run(self): | |
k=random.randint(10,20) |
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
# Copyright 2009 Brian Quinlan. All Rights Reserved. | |
# Licensed to PSF under a Contributor Agreement. | |
"""Execute computations asynchronously using threads or processes.""" | |
__author__ = 'Brian Quinlan ([email protected])' | |
from concurrent.futures._base import (FIRST_COMPLETED, | |
FIRST_EXCEPTION, | |
ALL_COMPLETED, |
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/env python | |
import requests | |
def get_servicetag_from_sn(sn): | |
url = "http://www.dell.com/support/troubleshooting/cn/zh/cndhs1/ExpressService/ExpressService/GetSpecificExpressServiceTag" | |
data = { | |
"TagCode": sn | |
} |
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
package main | |
import ( | |
"bufio" | |
"log" | |
"net/rpc" | |
"os" | |
) | |
func main() { |
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 | |
import os | |
import sys | |
import re | |
import logging | |
import time | |
import argparse | |
import pexpect | |
import subprocess |
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 -*- | |
""" 基础镜像构建脚本. | |
会自动构建依赖的镜像, 比如构建基础镜像 centos6, 则以 centos6 开头的镜像都会构建, 比如: | |
centos6-java8 | |
centos6-java8-tomcat8 | |
根据镜像长度判断依赖关系. |
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 ( | |
"singleton" | |
) | |
func main() { | |
mSingleton, nSingleton := singleton.NewSingleton("hello"), singleton.NewSingleton("hi") | |
mSingleton.SaySomething() | |
nSingleton.SaySomething() | |
c := make(chan int) |