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 | |
#------------------------------------------------------------------------------ | |
# Name: sbtmkdirs | |
# Purpose: Create an SBT project directory structure with a few simple options. | |
# Author: Alvin Alexander, http://alvinalexander.com | |
# Info: http://alvinalexander.com/sbtmkdirs | |
# License: Creative Commons Attribution-ShareAlike 2.5 Generic | |
# http://creativecommons.org/licenses/by-sa/2.5/ | |
#------------------------------------------------------------------------------ |
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 python2 | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import fileinput | |
""" | |
Ищет наиболее активный IP-адрес в логах. | |
""" | |
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 python2 | |
# -*- coding: utf-8 -*- | |
""" | |
В системе авторизации есть ограничение: | |
* логин должен начинаться с латинской буквы, | |
* состоять из латинских букв, цифр, точки и минуса, | |
* но заканчиваться только латинской буквой или цифрой; | |
* минимальная длина логина — один символ, максимальная — 20. |
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 python2 | |
# -*- coding: utf-8 -*- | |
import re | |
import random | |
import string | |
import cProfile | |
rgx = re.compile(r"^[a-zA-Z][a-zA-Z0-9.-]{0,18}[a-zA-Z0-9]$") | |
def rchecker(login): |
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
# Тест при помощи прохода по элементам логина и с использованием c not in string.ascii_letters | |
280001 function calls in 1.709 seconds | |
Ordered by: standard name | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
280000 1.709 0.000 1.709 0.000 logineffcheck.py:52(cchecker) | |
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} | |
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
def dc(a, b): | |
res = {} | |
blen = len(b) | |
for i,e in enumerate(a): | |
res[e] = i < blen and b[i] or None | |
return res |
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
cat /tmp/access.log |sort |uniq -c|sort -nr | head -n1 | awk '{print $2 ": " $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
/*global db,print*/ | |
var m = db.grades.aggregate( | |
{'$match': {'type': 'homework'}}, | |
{'$project': {"student_id": 1, "_id": 1, "score": 1}}, | |
{"$group": {"_id": "$student_id", "min": {"$min": "$score"}}} | |
).result; | |
for (var i in m) { | |
db.grades.remove({ 'student_id': m[i]._id, 'score': m[i].min }); | |
} |
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
user www-data; | |
worker_processes 4; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 768; | |
# multi_accept on; | |
} | |
http { |
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
upstream flask_serv { | |
server 127.0.0.1:8800; | |
} | |
server { | |
listen 80; | |
server_name 176.121.11.72; | |
access_log /var/log/nginx/localhost.access_log; | |
error_log /var/log/nginx/localhost.error_log; |
OlderNewer