Skip to content

Instantly share code, notes, and snippets.

View tbicr's full-sized avatar

Paveł Tyślacki tbicr

View GitHub Profile
@tbicr
tbicr / readme.md
Last active December 20, 2016 20:14
Miensk building levels

Пазначэньне колькасьці павярхоў будоўлі ў Менску

Вітаю, шаноўнае спадарства.

Гэтая кароткая іструкцыя скіравана на больш арганізаванае пазначэньне колькасьці павархоў будоўлі па Менску ў openstreetmap.org. Таксама яна закранае некаторыя пункты як можна дапамагчы ў зьбіраньні колькасьці павярхоў.

Добрага ўсім мапінгу!

Пірог

@tbicr
tbicr / mapcraft.gif
Last active December 17, 2016 21:45
Miensk building levels
mapcraft.gif
@tbicr
tbicr / coast.py
Created January 24, 2016 19:12
strip country border by land
"""Get country border by land.
In OSM countries borders include territorial waters. To get borders by
coastline you can get intersection of country and land.
This script take country geometry in wkt format and land geometries in shp
format and calculate country geometry by land.
Land geometries took from http://openstreetmapdata.com/data/land-polygons.
Land geometries have two variants - complete and split. Complete better for
@tbicr
tbicr / logstat.ipynb
Last active August 29, 2015 14:27
Jula log stat
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tbicr
tbicr / form.html
Created June 19, 2015 10:33
Stripe
<form action="" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_c4P2utKzYhQ7rec4rYhWOs9H"
data-amount="1"
data-name="Demo Site"
data-description="2 widgets ($20.00)"
data-image="/128x128.png">
</script>
</form>
@tbicr
tbicr / _voronoi_call_sample.py
Last active August 29, 2015 14:22
voronoi_call_sample.py
import csv
from contextlib import contextmanager
import psycopg2
@contextmanager
def cursor_context():
conn = psycopg2.connect(dbname='osm', user='tbicr', password='admin',
host='127.0.0.1', port='5432')
@tbicr
tbicr / source.list
Created March 19, 2015 10:32
ubuntu source.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb mirror://mirrors.ubuntu.com/mirrors.txt utopic main restricted universe multiverse
deb-src mirror://mirrors.ubuntu.com/mirrors.txt utopic main universe restricted multiverse
## Major bug fix updates produced after the final release of the
## distribution.
deb mirror://mirrors.ubuntu.com/mirrors.txt utopic-updates main restricted universe multiverse
deb-src mirror://mirrors.ubuntu.com/mirrors.txt utopic-updates main restricted universe multiverse
@tbicr
tbicr / f4.py
Created March 12, 2015 15:32
f4.py
from __future__ import print_function
class Node(object):
def __init__(self, data, next=None, random=None):
self.data = data
self.next = next
self.random = random
def __repr_ref(self, ref):
SELECT DISTINCT n.type, n.osm_id,
n.tags->'name', n.tags->'name:ru', n.tags->'name:be',
n.tags->'description', n.tags->'description:ru', n.tags->'description:be',
n.tags->'operator', n.tags->'operator:ru', n.tags->'operator:be',
n.tags->'addr:street', n.tags->'addr:housenumber',
n.tags->'addr:street' = a.street AND n.tags->'addr:housenumber' = a.housenumber,
ct.country, ct.region, ct.subregion, ct.city, a.street, a.housenumber
FROM (
SELECT CASE WHEN o.osm_id > 0 THEN 'w' ELSE 'r' END AS type, o.osm_id, o.tags, o.way
FROM osm_polygon c
@tbicr
tbicr / install.sh
Last active August 29, 2015 14:12
install odb
## 0. Get ubuntu (current gite for 14.04 LTS).
## 1. Add repositories
echo "deb http://ppa.launchpad.net/nginx/stable/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/nginx-stable.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C
sudo apt-get update
## 2. Install software
sudo apt-get -yq install nginx mysql-server php5-mysql php5-fpm