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 | |
import argparse | |
import json | |
import os.path | |
import re | |
import sys | |
try: | |
# python 2 |
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 java.util.LinkedList; | |
public class ParenCheck { | |
static int OPENING = 1, CLOSING = -1; | |
static int PAREN = 0, BRACKET = 1, BRACE = 2, PAIRING = 3; | |
static String[] desc = { "()", "[]", "{}", "Pairing" }; | |
static int[] check(char[] s) { | |
int[] stat = new int[4]; | |
int sym, type; |
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
package alt; | |
import static java.net.HttpURLConnection.*; // http status codes | |
import java.io.*; | |
import java.net.InetSocketAddress; | |
import java.text.SimpleDateFormat; | |
import java.util.*; | |
import java.util.concurrent.Executors; | |
import java.util.logging.Logger; |
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://api.yandex.com/maps/doc/geocoder/desc/concepts/About.xml | |
import argparse | |
import requests | |
from collections import OrderedDict | |
from pprint import pprint | |
YANDEX_GEOCODER_URL = 'http://geocode-maps.yandex.ru/1.x/' | |
FORMAT_CHOICES = ('json', 'xml') |
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 re | |
import sys | |
from collections import Counter | |
from pymorphy2 import MorphAnalyzer | |
morph = MorphAnalyzer() | |
def words(text): | |
return re.findall('[а-яА-Яa-zA-Z-]+', text.lower()) |
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 operator as op | |
# Simple calculator that can add, subtract, multiply and divide | |
OPS = (("Add", "+", op.iadd), | |
("Subtract", "-", op.isub), | |
("Multiply", "*", op.imul), | |
("Divide", "/", op.truediv)) | |
valid_choices = list(map(str, range(1, len(OPS)+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
import requests | |
from collections import namedtuple | |
from xml.etree import ElementTree | |
""" Client for http://gismeteo.ru """ | |
# Sample forecast section: | |
# | |
# <FORECAST day="29" month="03" year="2016" hour="03" tod="0" predict="0" weekday="3"> | |
# <PHENOMENA cloudiness="0" precipitation="10" rpower="0" spower="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
from django import conf, http, urls | |
conf.settings.configure( | |
DEBUG = True, | |
ROOT_URLCONF = __name__ | |
) | |
def index(request): |
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
# example.conf | |
# the upstream component nginx needs to connect to | |
upstream example { | |
server unix:///tmp/example.sock; # for a file socket | |
} | |
# configuration of the server | |
server { | |
listen 80; |
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/sh | |
git_revision=$(git rev-parse HEAD) | |
echo "git_revision='$git_revision'" > version.py |
OlderNewer