书摘
-
事件触发
-
单线程
-
无阻塞
-
模块和包
| {"lastUpload":"2021-01-27T08:52:53.923Z","extensionVersion":"v3.4.3"} |
| def prn_obj(obj): | |
| print ', '.join(['%s:%s' % item for item in obj.__dict__.items()]) |
| import functools | |
| import pymongo | |
| import logging | |
| import time | |
| MAX_AUTO_RECONNECT_ATTEMPTS = 5 | |
| def graceful_auto_reconnect(mongo_op_func): | |
| """Gracefully handle a reconnection event.""" | |
| @functools.wraps(mongo_op_func) |
| I, Robert, have read and do accept the MuleSoft Contributor Agreement | |
| at http://www.mulesoft.org/legal/contributor-agreement.html | |
| Accepted on Sun Nov 01 2015 02:15:42 GMT+0800 (CST) |
| ps_check () { | |
| psname="$1" | |
| #pslist=`ps aux | grep $psname` | |
| pscount=`ps aux | grep $psname | wc -l` | |
| pscount=`expr $pscount` | |
| if [ "$pscount" -gt 1 ] | |
| then | |
| echo $psname" is running ... [Success]" | |
| else | |
| echo $psname" is not run ... [Fail]" |
| sudo -s | |
| CFLAGS=-Qunused-arguments | |
| CPPFLAGS=-Qunused-arguments | |
| ARCHFLAGS="-arch x86_64" | |
| CFLAGS=-Wunused-command-line-argument-hard-error-in-future | |
| pip install mysql-python |
| <?php | |
| /* | |
| 每次新项目, 都要为环境配置做许多php的修正, 为此, 我整理了这一份通用的php抬头文件. | |
| 使用方法, 将代码保存为某个php文件, 然后在项目中引入即可. | |
| 代码作用如下: | |
| 1: 规范化编码问题, utf-8, 时间区域, 数字长度都有变更. | |
| 2: 规范化字符转义问题, 全部采用php5.3之后的标准, 都不转化. | |
| 3: session, gzip做判断启动. 这有利于防止隐性冲突. | |
| 4: 对SERVER数组进行整理, 隐藏掉一些非安全段, 增加以HTTP_开头的一些数据, 如内存占用, 起始时间, 当前url地址, ip, get, post等等. 你只要打印出$_SERVER数组, 基本上许多数据就都有了, 并且它是超全局的. |
| -- 在 MySQL 中拷贝表,将 old_table 表拷贝为 new_table 表。 | |
| -- 1. 不拷贝表数据,只拷贝结构。 | |
| CREATE TABLE new_table LIKE old_table | |
| -- 2. 通过 SELECT 查询来拷贝,new_table 表会丢失主键、索引等信息。 | |
| CREATE TABLE new_table AS |