Skip to content

Instantly share code, notes, and snippets.

View stepankuzmin's full-sized avatar
🥡

Stepan Kuzmin stepankuzmin

🥡
View GitHub Profile

macOS setup

defaults write -g ApplePressAndHoldEnabled -bool false
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
brew tap homebrew/cask-fonts
brew cask install font-fira-code
@stepankuzmin
stepankuzmin / docker-compose.yml
Created May 11, 2018 14:03
traefik docker-compose.yml
version: '3.6'
services:
traefik:
image: traefik:1.6-alpine
container_name: traefik
restart: always
ports:
- 80:80
- 443:443

Count features in MVT tile

Usage:

npm i @mapbox/vector-tile
node count-features-in-tile.js tile.pbf
@stepankuzmin
stepankuzmin / debian-mysql-client-8.sh
Last active February 1, 2019 03:03
Install mysql-client 8 on Debian
wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
dpkg -i mysql-apt-config_0.8.10-1_all.deb # choose OK
apt-get update
apt-get install mysql-client
@stepankuzmin
stepankuzmin / vt.js
Created June 26, 2018 11:00
Reading vector tiles from PostGIS
const zlib = require("zlib");
const Protobuf = require("pbf");
const postgis = require("tilelive-postgis");
const tilelive = require("@mapbox/tilelive");
const VectorTile = require("@mapbox/vector-tile").VectorTile;
postgis.registerProtocols(tilelive);
const uri =
"postgis://postgres@localhost/test?table=test&layerName=myLayer&geometry_field=geom";
@stepankuzmin
stepankuzmin / example.rs
Last active August 7, 2018 11:44
Rust trait with lifetime example
use std::collections::HashMap;
pub trait Source<'a> {
fn get_id(&self) -> &'a str;
}
pub type Sources<'a> = HashMap<&'a str, Source<'a>>;
#[derive(Copy, Clone, Debug)]
pub struct TableSource<'a> {
@stepankuzmin
stepankuzmin / postgis.md
Last active September 16, 2018 16:21
build postgis from svn-trunk

postgresql.conf -> log_min_messages = debug1

postgis_config.h.in -> #define POSTGIS_DEBUG_LEVEL 1

./autogen.sh
./configure --enable-debug
make
make install
@stepankuzmin
stepankuzmin / README.md
Created October 8, 2018 11:46
Git rebase upstream master example
git remote add upstream [email protected]:mapbox/mapbox-gl-js.git
git fetch upstream
git rebase upstream/master
@stepankuzmin
stepankuzmin / midnight-timezones.sql
Created November 12, 2018 17:58
PostgreSQL: select all timezones where is currently midnight
select * from pg_timezone_names where date_part('hour', (now() at time zone 'UTC') + utc_offset) = 0;
# -*- sh -*- vim:set ft=sh ai et ts=2 sw=2 sts=2:
# It might be bash like, but I can't have my co-workers knowing I use zsh
PROMPT='%{$fg[magenta]%}%n@%m:%{$fg_bold[blue]%}%2~ $(git_prompt_info)%{$reset_color%}%(!.#.$) '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}"