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 | |
# coding: utf-8 | |
from PIL import Image | |
import sys, os | |
#@app.route("/thumbs") | |
def thumbs(): | |
# not good (type of values) but something like this |
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
{ | |
"fmt_cmd": [ | |
"goimports" | |
], | |
"autocomplete_closures": true, | |
"complete_builtins": true, | |
"comp_lint_enabled": true, | |
"comp_lint_commands": [ | |
{"cmd": ["golint *.go"], "shell": true}, | |
{"cmd": ["go", "vet"]}, |
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 | |
# | |
# Vkontatke OAuth 2.0 wrapper | |
# Copyright 2011, Adil Khashtamov [[email protected]] | |
# http://khashtamov.kz | |
# | |
# | |
import logging |
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.httpserver | |
import tornado.web | |
import tornado.ioloop | |
def handle_request(request): | |
message = "You requested %s\n" % request.uri | |
request.write("HTTP/1.1 200 OK\r\nContent-Length: %d\r\n\r\n%s" % ( | |
len(message), message)) | |
request.finish() |
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
class bcolors: | |
HEADER = '\033[95m' | |
OKBLUE = '\033[94m' | |
OKGREEN = '\033[92m' | |
WARNING = '\033[93m' | |
FAIL = '\033[91m' | |
ENDC = '\033[0m' | |
def disable(self): | |
self.HEADER = '' |
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
http://ubuntuforums.org/showthread.php?t=1267853 | |
http://www.pendrivelinux.com/ubuntu-toram-how-to-make-ubuntu-boot-to-ram/ | |
http://reboot.pro/topic/14547-linux-load-your-root-partition-to-ram-and-boot-it/ | |
http://askubuntu.com/questions/275795/customizing-ubuntu-to-run-from-ram-only-within-grub-options | |
http://askubuntu.com/questions/28671/distro-that-i-can-load-into-ram |
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
# root, сначала надо обновить репозиторий, | |
# /etc/apt/source.list | |
#deb http://archive.ubuntu.com/ubuntu/ raring main restricted universe multiverse | |
#deb http://security.ubuntu.com/ubuntu/ raring-security main restricted universe multiverse | |
#deb http://archive.ubuntu.com/ubuntu/ raring-updates main restricted universe multiverse | |
apt-get update | |
#apt-get -y install apache2-utils | |
#apt-get -y install tortoisehg mercurial mc htop chromium-browser | |
apt-get -y install git mercurial mc htop |
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 collections | |
import re | |
buildings = collections.defaultdict(dict) | |
with open('travian/buildings.txt') as fh: | |
for line in fh.readlines(): | |
if re.match(r'#\s.', line): |
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 | |
field = [ | |
{'cost': 10, 'prod': 2, 'time': 3}, | |
{'cost': 20, 'prod': 3, 'time': 4} | |
] | |
total_resource, base_production, total_time = 0, 1, 0 | |
lvl = 0 | |
required_lvl = len(field) |
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
class BaseHandler(RequestHandler): | |
COOKIE_SESSION = 'sid' | |
def get_current_user(self): | |
sid = self.get_secure_cookie(COOKIE_SESSION) | |
if not sid: | |
sid = '%s' % uuid4() | |
db.sessions.insert({'sid': sid, 'date_created': datetime.datetime.now()) | |
return False | |
session = db.session.find_one({'sid': sid}) | |
return sid |