##上传文件
使用浏览器访问 YOUR.DOMAIN.COM/up , 然后选择文件, 点击上传
使用命令 curl YOUR.DOMAIN.COM -T *FILE*
def import_object(name): | |
"""Imports an object by name. | |
import_object('x') is equivalent to 'import x'. | |
import_object('x.y.z') is equivalent to 'from x.y import z'. | |
>>> import tornado.escape | |
>>> import_object('tornado.escape') is tornado.escape | |
True | |
>>> import_object('tornado.escape.utf8') is tornado.escape.utf8 |
# copy from `https://github.com/damonchen/onion/blob/master/onion/utils/_dict.py` | |
# and `https://github.com/damonchen/onion/blob/master/onion/utils/tools.py` | |
class JsDict(dict): | |
def __getattr__(self, key): | |
try: | |
v = self[key] | |
except: | |
v = None |
import errno | |
import fcntl | |
''' | |
just run this script twice to see different output | |
''' | |
''' | |
`doc string in fcntl.lockf` | |
When operation is LOCK_SH or LOCK_EX, it can also be bitwise ORed with |
# ubuntu | |
# sqlalchemy for python | |
sudo pip install sqlalchemy | |
# redis for python | |
sudo pip install redis | |
# tornado for python | |
sudo pip install tornado | |
# supervisor for python | |
sudo pip install supervisor |
for i in range(1, 10): | |
for j in range(1, i + 1): | |
print '%d*%d=%2d' % (i, j, i * j), | |
print '' | |
print '' |
#!/usr/bin/env python | |
# -*- coding:utf8 -*- | |
''' | |
Author : myth | |
Date : 14-12-11 | |
Email : belongmyth at 163.com | |
''' | |
import pexpect | |
import json |
# configure nginx with rtmp module | |
# about more set headers module - http://wiki.nginx.org/HttpHeadersMoreModule | |
# get download uri from : https://github.com/openresty/headers-more-nginx-module/tags | |
wget https://github.com/openresty/headers-more-nginx-module/archive/v0.25.tar.gz | |
# about rtmp module - https://github.com/arut/nginx-rtmp-module | |
# fork and clone the repo to localhost | |
# get nginx | |
wget http://nginx.org/download/nginx-1.7.9.tar.gz | |
# remember add module when configure nginx | |
./configure --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_auth_request_module --with-mail --with-pcre --add-module=/home/myth/workspace/github/nginx-rtmp-module --add-module=/home/myth/software/more_set_headers |
ps -ef | grep curl | grep -v grep | awk -F ' ' '{print $2}' | xargs kill -9 |
Predefined template variables | |
PyCharm comes with a set of predefined template variables. | |
The available predefined file template variables are: | |
${PROJECT_NAME} - the name of the current project. | |
${NAME} - the name of the new file which you specify in the New File dialog box during the file creation. | |
${USER} - the login name of the current user. | |
${DATE} - the current system date. |