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 | |
# https://gist.github.com/opensourcegeek/9822127 | |
from gevent import monkey | |
monkey.patch_all() | |
import logging | |
import gevent | |
from gevent.queue import Queue, Empty | |
import pymysql as 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
sudo -i | |
cd | |
apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y | |
wget http://www.imagemagick.org/download/ImageMagick-6.8.7-7.tar.gz | |
tar xzvf ImageMagick-6.8.9-1.tar.gz | |
cd ImageMagick-6.8.9-1/ | |
./configure --prefix=/opt/imagemagick-6.8 && make | |
checkinstall |
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
#include <stdio.h> | |
#include <string.h> | |
/* | |
gcc compile with -fno-stack-protector to disable "stack Smashing Protection" | |
*/ | |
int main(void) | |
{ | |
char buff[6]; |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char const *argv[]) | |
{ | |
int i; | |
for(i=0; i<2; i++){ | |
fork(); | |
printf("-"); | |
} |
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 | |
# http://stackoverflow.com/questions/3173320/text-progress-bar-in-the-console | |
import sys | |
import time | |
i = 0 | |
while i<100: | |
time.sleep(0.3) | |
i += 1 | |
#sys.stdout.write("\r{}".format(i)) |
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 |
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
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
#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
#!/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" |