This file contains 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 | |
# http://stackoverflow.com/questions/9166400/convert-rgba-png-to-rgb-with-pil | |
# http://stackoverflow.com/questions/1962795/how-to-get-alpha-value-of-a-png-image-with-pil | |
import sys | |
from PIL import Image | |
def main(): | |
png = Image.open(sys.argv[1]) | |
png.load() | |
background = Image.new("RGB", png.size, (255, 255, 255)) |
This file contains 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 | |
welcome=( | |
'佛祖保佑 永无BUG' | |
'你好啊单身狗' | |
'壮士,干了这碗鸡汤!' | |
'上线了吗?' | |
'法海,你的头发怎么那么长!' | |
'少壮不努力,长大做挨踢.' | |
'佛祖,我好烦.' |
This file contains 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 os | |
import sys | |
import random | |
# more info | |
# http://trac.edgewall.org/export/10770/trunk/contrib/htpasswd.py | |
# We need a crypt module, but Windows doesn't have one by default. Try to find | |
# one, and tell the user if we can't. | |
try: |
This file contains 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
proxy_cache_path /data/nginx/cache/ levels=1:2 keys_zone=one:10m max_size=10g; | |
proxy_cache_key "$host$request_uri"; | |
upstream google_jp { | |
server 173.194.38.216:80; | |
server 173.194.38.215:80; | |
server 173.194.38.217:80; | |
server 173.194.38.218:80; | |
} | |
This file contains 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 | |
echo " = = = = = back up start @ `date` = = = = = " | |
BACKUP_DIR="/opt/data/backup" | |
DUMP_CMD="/usr/bin/mysqldump" | |
HOST="127.0.0.1" | |
PORT="3306" | |
USER="root" | |
PASSWORD="123456" | |
cd $BACKUP_DIR | |
TIMESTAMP=`date +%F-%H%M` |
This file contains 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 | |
BACKUP_DB="xx" | |
DUMP_CMD="/usr/bin/mongodump" | |
HOST="127.0.0.1" | |
PORT="27017" | |
TIMESTAMP=`date +%F-%H%M` | |
BACKUP_DIR="/opt/data/backup" | |
cd $BACKUP_DIR | |
BACKUP_NAME_PREFIX="app-db" |
This file contains 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
#coding:utf-8 | |
from gevent import monkey | |
monkey.patch_all() | |
import logging | |
import gevent | |
import datetime | |
logging.basicConfig(level=logging.DEBUG) | |
LOGGER = logging.getLogger("GeventCelery") |
This file contains 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 os | |
import inspect | |
import atexit | |
from functools import wraps | |
class OneProcess(object): | |
def __init__(self): | |
self.caller_file_name = inspect.getouterframes( |
This file contains 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 | |
convert $1 -channel A -blur 1x65000 -level 50x100% \ | |
-channel rgba $2 |
This file contains 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
#coding:utf-8 | |
from gevent import monkey | |
monkey.patch_all() | |
import logging | |
import gevent | |
logging.basicConfig(level=logging.DEBUG) | |
LOGGER = logging.getLogger("GeventTaskQueue") | |
from gevent.queue import Queue, Empty |