05 2016 档案
Python 多线程 类和方法
摘要:import threading import time import random def threadFun(): for i in range(10): print("ThreadFun - %d" %i) time.sleep(random.randrange(0,2)) class ThreadClass(threading.Thread):... 阅读全文
posted @ 2016-05-26 16:14 漫步的影子 阅读(699) 评论(0) 推荐(0)
python 后台运行
摘要:def createDaemon(): try: if os.fork() >0: os._exit(0) except OSError as error: err_msg = "fork #1 failed: %d (%s)" %(error.errno, error.strerror) logging.e... 阅读全文
posted @ 2016-05-26 14:52 漫步的影子 阅读(208) 评论(0) 推荐(0)
python 类 属性get set
摘要:#coding:utf-8 class Person(object): def __init__(self,name, age): self._name = name self._age = age @property def name(self): return self._name @property ... 阅读全文
posted @ 2016-05-23 09:44 漫步的影子 阅读(697) 评论(0) 推荐(0)
Nginx 获取版本和配置信息
摘要:Nginx -V 输出到stderr src/core/nginx.c src/core/ngx_log.h shell ps获取版本信息 shell ps获取nginx版本和配置信息 阅读全文
posted @ 2016-05-19 10:45 漫步的影子 阅读(930) 评论(0) 推荐(0)
shell 脚本参数解析
摘要:一、getopts 短选项 二、getopt 长短选项 三、$@ 阅读全文
posted @ 2016-05-18 09:54 漫步的影子 阅读(821) 评论(0) 推荐(0)
RabbitMQ Hello篇
摘要:生产者: 消费者: eg:生产者循环1-100 发送消息,启动两个消费者,如下图 阅读全文
posted @ 2016-05-17 21:40 漫步的影子 阅读(239) 评论(0) 推荐(0)
Flask config.py 项目加载配置文件
摘要:from flask import Flask app = Flask(__name__) app.config.from_object("config") #只识别大写 key.isupper() app.config.from_file("config.py") #在 root_path目录下, silent=True 配置文件不存在返回False,不会抛出异常app.config.fr... 阅读全文
posted @ 2016-05-13 14:48 漫步的影子 阅读(996) 评论(0) 推荐(0)
python 多个关键字替换
摘要:来源于网络 阅读全文
posted @ 2016-05-10 14:43 漫步的影子 阅读(1056) 评论(0) 推荐(0)
shell 生成数组
摘要:echo {a..z} >>a b c d e f g h i j k l m n o p q r s t u v w x y z seq option LASTseq option FIRST LASTseq option FIRST INCREMENT LAST起始默认为1 间隔默认为1echo $(seq 0 5) >>0 1 2 3 4 5 echo $(seq 0 2 10) >>0... 阅读全文
posted @ 2016-05-10 11:38 漫步的影子 阅读(420) 评论(0) 推荐(0)
python socket 检测服务器端口
摘要:#!/usr/bin/env python import socket import re import sys def check_server(address, port): s = socket.socket() print("Attempting to connect to %s on port %s" % (address, port)) try: ... 阅读全文
posted @ 2016-05-10 11:06 漫步的影子 阅读(624) 评论(0) 推荐(0)
Python requets 登录51cto家园
摘要:#-coding:utf-8 -*- import requests import urllib from bs4 import BeautifulSoup HEADERS={ "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.26... 阅读全文
posted @ 2016-05-09 21:26 漫步的影子 阅读(402) 评论(2) 推荐(0)
Python 32位 or 64位
摘要:In [4]: import platform In [5]: platform.architecture() Out[5]: ('32bit', 'WindowsPE') 阅读全文
posted @ 2016-05-05 15:45 漫步的影子 阅读(308) 评论(0) 推荐(0)