Skip to content

Instantly share code, notes, and snippets.

View otykhonruk's full-sized avatar

Oleksandr Tykhonruk otykhonruk

View GitHub Profile
@otykhonruk
otykhonruk / geocode.py
Last active March 4, 2016 08:18
Client for Yandex geocoding service.
# 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')
@otykhonruk
otykhonruk / ZipHttpServer.java
Created August 7, 2013 10:30
HTTP server that serves content of zip files. Useful for huge zipped piles of html, for example Java SDK docs.
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;
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;
#!/usr/bin/env python
import argparse
import json
import os.path
import re
import sys
try:
# python 2