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 servers import fastcgi | |
import os | |
from jsonrpcstaff import ServiceHandler, configLogger | |
import logging | |
configLogger(level=logging.DEBUG) | |
class Service(object): |
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
autoload -U compinit | |
compinit -C | |
zstyle ':completion:*' menu yes select | |
zstyle ':completion:*:(ssh|scp):*:users' ignored-patterns `cat /etc/passwd | awk -F ":" '{ if($3<1000) print $1 }'` | |
zstyle ':completion:*:processes' command 'ps xua' | |
zstyle ':completion:*:processes' sort false | |
zstyle ':completion:*:processes-names' command 'ps xho command' | |
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' |
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 sys | |
from psycopg2 import connect | |
from DBSingleStyle import Param, to_format | |
if __name__=='__main__': | |
query = ('SELECT table_name, column_name, data_type \ | |
FROM information_schema.columns WHERE table_name=', Param(sys.argv[1])) |
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
SELECT | |
tc.constraint_name, tc.table_name, kcu.column_name, | |
ccu.table_name AS foreign_table_name, | |
ccu.column_name AS foreign_column_name | |
FROM | |
information_schema.table_constraints AS tc | |
JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name | |
JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name | |
WHERE constraint_type = 'FOREIGN KEY' AND tc.table_name='ИМЯ ТАБЛИЦЫ'; |
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
set nocompatible | |
set nobackup | |
set history=50 | |
set showcmd | |
set ruler | |
set hlsearch | |
set incsearch | |
set smartcase | |
set cmdheight=1 | |
syntax enable |
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
''' | |
- WebHandler wraps next WebHandler and make desicion what to return (like decorators) | |
- WebHandler may return Response object and that will be the end of current chain, even | |
there are other handlers. | |
- If WebHandler returns None means that this chain is not for current request, | |
so we ask next chain. If this chain was last status 404 returns to client. | |
- There are two datastructures for data accumulation 'data' and 'env'. | |
'data' - template data | |
'env' - environment data (db sessions, template renderers, url_for, ...) | |
These structures are mutable during request processing. The only significant thing, |
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 -*- | |
def edit_distance(first_word, second_word): | |
first_word_len = len(first_word) | |
second_word_len = len(second_word) | |
matrix = [[0 for j in range(second_word_len+1)] \ | |
for i in range(first_word_len+1)] | |
for i in range(1, first_word_len+1): | |
for j in range(1, second_word_len+1): | |
cost = first_word[i-1] != second_word[j-1] and 1 or 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
Цели: | |
- упростить процесс локализации и интернационализации текстовых данных (gettext — не лучший вариант) | |
- упростить процесс внедрения локализации и интернационализации в питон проекты | |
- возможность использования уже существующих средств (в том числе и графических) для перевода строк | |
Фичи: | |
- перевод строк | |
- перевод строк, зависимых от числа или чисел | |
- возможность изменения представления дат, времени и чисел в зависимости от локали | |
- импорт/экспорт PO файлов |
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 sqlalchemy import create_engine | |
from sqlalchemy.types import SchemaType | |
from sqlalchemy.engine import reflection | |
from sqlalchemy.schema import ( | |
MetaData, | |
Table, | |
DropTable, | |
ForeignKeyConstraint, |
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
egrep --color=always \<\([-.a-zA-Z0-9]+:\)?\(simple\|complex\)Type $(find . -name '*.xsd') | sed -r -e "s/:(.*)name=(\"|')([-.:a-zA-Z0-9]+)(\"|')(.*)/: \3/g" |