Skip to content

Instantly share code, notes, and snippets.

View demiurg's full-sized avatar

Pavel demiurg

View GitHub Profile
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"flake8": {
@demiurg
demiurg / clustering.py
Last active August 29, 2015 14:01
simple clusters
#FOR DBSCAN
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
from sklearn.preprocessing import StandardScaler
from random import randrange
import math
from numpy import array, argwhere
#For Kmeans
import os
from os.path import *
import shutil
brewdirs = set()
for r, d, files in os.walk('/usr/local/lib'):
for n in files:
f = join(r,n)
if islink(f) and "/Cellar/" in realpath(f):
dirs = f.split('/')
g++ -o ./generate_tile test/generate_tile.cpp src/vector_tile.pb.cc -I./src -I/usr/include -I/usr/include/mapnik/agg -I/usr/include -I/usr/include/freetype2 -I/usr/include/libxml2 -I/usr/include/gdal -I/usr/include/postgresql -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -DBIGINT -DBOOST_REGEX_HAS_ICU -DHAVE_JPEG -DMAPNIK_USE_PROJ4 -DHAVE_PNG -DHAVE_TIFF -DLINUX -DMAPNIK_THREADSAFE -DNDEBUG -DHAVE_CAIRO -DGRID_RENDERER -DSHAPE_MEMORY_MAPPED_FILE -DHAVE_LIBXML2 -g -O3 -Wall -pthread -ftemplate-depth-300 -O3 -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts -Wsign-compare -pthread -L/usr/lib -lmapnik -L/usr/lib -L/usr/lib/x86_64-linux-gnu -lfreetype -licuuc -lboost_filesystem -lboost_system -lboost_regex -lproj -lpng -ltiff -ljpeg -lxml2 -lz -lboost_thread -licui18n -ldl -lcairo -DBIGINT -DBOOST_REGEX_HAS_ICU -DHAVE_JPEG -DMAPNIK_USE_PROJ4 -DHAVE_PNG -DHAVE_TIFF -DLINUX -DMAPNI
# Example of using Fiona, pyproj, and Shapely together in a functional
# style.
import functools
import itertools
import logging
import sys
import fiona
from pyproj import Proj, transform
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start