Skip to content

Instantly share code, notes, and snippets.

View Komzpa's full-sized avatar

Darafei Praliaskouski Komzpa

View GitHub Profile
debian:/home/kom/svn/mapnik2# ldd /usr/lib/libboost_filesystem.so
linux-vdso.so.1 => (0x00007fffb17ff000)
libboost_system.so.1.46.1 => /usr/lib/libboost_system.so.1.46.1 (0x00007f9341520000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f9341318000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f934100d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9340d8b000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9340b75000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9340958000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f93405d4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f934194f000)
area[area:highway=motorway]{fill-color:#809bc0}
area[area:highway=trunk]{fill-color:#7fc97f}
area[area:highway=primary]{fill-color:#fb805f}
area[area:highway=secondary]{fill-color:#fdbf6f}
area[area:highway=tertiary]{fill-color:#f7f496}
area[area:highway=residential]{fill-color:#c0c0c0}
area[area:highway=service]{fill-color:#809bc0}
area[area:highway=footway]{fill-color:#00ff00}
drop table place_point;
create table place_point as (
select
osm_id,
place,
coalesce(tags->'short_name:en', tags->'name:en', tags->'int_name', name, tags->'name:ru', tags->'name:be', name) as name,
tags,
(case
when
((capital = '2') or
#include "NewGameMenu.h"
const
int
BUTTON_HEIGHT
=
80
;
const
int
BUTTON_WIDTH
cpp_source = open("cpp.cpp").read()
# удаляем whitespace
cpp_source = cpp_source.replace('\t', ' ')
cpp_source = cpp_source.replace(' ', ' ')
# удаляем комментарии
cpp_source = re.sub('//.*?$|/\*.*\*/', '', cpp_source, flags= re.S | re.M)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import logging
import re
from itertools import islice
def window(seq, n=2):
"Returns a sliding window (of width n) over data from the iterable"
" s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... "
@Komzpa
Komzpa / upgrade-postgres-9.4-to-9.5-to-9.6-to-10.md
Last active January 15, 2021 18:04 — forked from dideler/upgrade-postgres-9.3-to-9.4.md
Upgrading PostgreSQL from 9.4 to 9.5 to 9.6 to 10 when upgrading Ubuntu 14.10 to 16.04

TL;DR

9.4 -> 9.5:

sudo pg_dropcluster 9.5 main --stop
sudo service postgresql stop
sudo pg_upgradecluster -m upgrade -k 9.4 main
sudo su postgres -c "/usr/lib/postgresql/9.5/bin/vacuumdb --all --analyze-in-stages"
sudo pg_dropcluster 9.4 main
create or replace function _final_median(anyarray)
returns float8 as $$
with q as
(
select val
from unnest($1) val
where VAL is not null
order by 1
),
cnt as
gis=> create or replace function 😼ify ( 😼 integer )
gis-> returns text as $$
gis$> select 😼::text||'😼'
gis$> $$ language 'sql' strict;
CREATE FUNCTION
gis=>
gis=> create operator 😼(
gis(> leftarg = integer,
gis(> procedure = 😼ify
gis(> );
@Komzpa
Komzpa / aaa.sql
Created October 19, 2016 11:32
compare case and nullif
create or replace function aaa(aaa integer)
returns text as $$
begin
raise notice 'passed1';
return aaa :: text || '😼';
end
$$ language 'plpgsql' strict;
select case when aaa(1) = '1'
then null