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 | |
import urllib2 | |
import sys | |
import random | |
import re | |
import threading | |
request_counter = 0 | |
flag = 0 |
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 /var/cache/nginx levels=1:2 keys_zone=microcache:5m max_size=1000m; | |
server { | |
listen 80; | |
server_name cache.example.ru; | |
# кешируемый адрес | |
location / { | |
# кеш включен по умолчанию | |
set $no_cache ""; | |
# отключаем кеш для всех методов, кроме GET и HEAD | |
if ($request_method !~ ^(GET|HEAD)$) { |
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 mongoengine import * | |
import random, string | |
import minimongo as mm | |
from pymongo import MongoClient | |
class MongoEngine_Model1(DynamicDocument): | |
a = StringField() | |
meta = {'collection': 'test'} |
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 flask import Flask, request, jsonify | |
import mongoengine as me | |
class User(me.Document): | |
email = me.EmailField(required = True) | |
register_at = me.DateTimeField(required = True) | |
activation = me.BooleanField() |
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 subprocess | |
subprocess.call(['runas', '/user:Administrator', 'C:/my_program.exe']) |
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 | |
import tornado.ioloop | |
import tornado.web | |
import tornado.httpclient | |
import tornado.autoreload | |
def handler_request(response): | |
if response.error: | |
print response.error |
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 tornado.ioloop | |
count = 0 | |
def print_hello(): | |
global count | |
print(count, "Hello") | |
count += 1 | |
timer = tornado.ioloop.PeriodicCallback(print_hello, 300) | |
timer.start() |
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 tornado.ioloop | |
import tornado.autoreload | |
from PyQt4 import QtGui | |
import sys | |
class Window(QtGui.QWidget): | |
def __init__(self): | |
super(Window, self).__init__() | |
self.timer = tornado.ioloop.PeriodicCallback(self.printable, 300) | |
self.timer.start() |
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
from PyQt4 import QtCore, QtGui, QtWebKit | |
import sys | |
class Browser(QtGui.QMainWindow): | |
def __init__(self): | |
""" | |
Initialize the browser GUI and connect the events | |
self.html.settings -> QtWebKit.QWebSettings | |
""" |
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 PIL import Image, ImageDraw, ImageFont | |
from random import randint, choice | |
import StringIO, string | |
def captcha(): | |
key = ''.join( [choice(string.ascii_lowercase + string.digits) for i in xrange(5)] ) | |
img = Image.new('RGB', (100,30), 0xffffff ) |
OlderNewer