This file contains hidden or 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/python | |
# coding: utf-8 | |
""" send dict to templates. Don't forget set """ | |
from django.conf import settings | |
def sett_to_tpl(): | |
""" send dict to templates """ | |
# todo: is it needhas to be settings.get('SETT_TO_TPL', '') | |
return {'SETT_TO_TPL': } |
This file contains hidden or 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 sys | |
import time | |
for i in xrange(100): | |
sys.stdout.flush() | |
time.sleep(0.5) | |
sys.stdout.write('\r' + str(i)) |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains hidden or 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
Code Country name Year ccTLD ISO 3166-2 Notes | |
AD Andorra 1974 .ad ISO 3166-2:AD | |
AE United Arab Emirates 1974 .ae ISO 3166-2:AE | |
AF Afghanistan 1974 .af ISO 3166-2:AF | |
AG Antigua and Barbuda 1974 .ag ISO 3166-2:AG | |
AI Anguilla 1983 .ai ISO 3166-2:AI AI previously represented French Afar and Issas | |
AL Albania 1974 .al ISO 3166-2:AL | |
AM Armenia 1992 .am ISO 3166-2:AM | |
AO Angola 1974 .ao ISO 3166-2:AO | |
AQ Antarctica 1974 .aq ISO 3166-2:AQ Covers the territories south of 60° south latitude Code taken from name in French: Antarctique |
This file contains hidden or 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/python | |
# coding: utf-8 | |
""" Parsing xml file. Basic example """ | |
from StringIO import StringIO | |
from datetime import datetime | |
from lxml import etree | |
import urllib2 | |
print """ | |
Test script. |
This file contains hidden or 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/python | |
# coding: utf-8 | |
""" """ | |
def mediana(_list=None): | |
""" | |
Медиана (50-й перцентиль, квантиль 0,5) — возможное значение признака, которое делит ранжированную совокупность | |
(вариационный ряд выборки) на две равные части: 50 % «нижних» единиц ряда данных будут иметь значение признака | |
не больше, чем медиана, а "верхние" 50 % — значения признака не меньше, чем медиана. |
This file contains hidden or 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 smtplib, os | |
from email.MIMEMultipart import MIMEMultipart | |
from email.MIMEBase import MIMEBase | |
from email.MIMEText import MIMEText | |
from email.Utils import COMMASPACE, formatdate | |
from email import Encoders | |
def send_mail(send_from, send_to, subject="", text="", files=None, server='smtp.google.ru'): | |
if files == None: | |
files = [] |
This file contains hidden or 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
server { | |
listen 80; | |
server_name localhost; | |
root /home/website/web; | |
rewrite ^/app\.php/?(.*)$ /$1 permanent; | |
try_files $uri @rewriteapp; | |
location @rewriteapp { |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<style> | |
body { | |
margin: 0; | |
} |
This file contains hidden or 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
var unique = function(array) { | |
return array.reduce(function(memo, elem) { | |
if (memo.indexOf(elem) < 0) memo.push(elem); | |
return memo; | |
}, []); | |
}; | |
// Example | |
// | |
// var callback = function(error, data) {console.log('Done.', error, data);}; |
This file contains hidden or 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/env python2 | |
# encoding: utf-8 | |
import re | |
try: | |
from unidecode import unidecode | |
except ImportError: | |
Exception("pip install unidecode") | |