Skip to content

Instantly share code, notes, and snippets.

View tbicr's full-sized avatar

Paveł Tyślacki tbicr

  • pandadoc.com
  • Miensk, Biełaruś
View GitHub Profile
@tbicr
tbicr / Pyparsion.ipynb
Created June 27, 2014 11:51
pyparsing example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
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 / 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):
@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 / _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 / 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 / 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.