Skip to content

Instantly share code, notes, and snippets.

View stepankuzmin's full-sized avatar
🥡

Stepan Kuzmin stepankuzmin

🥡
View GitHub Profile
$ node --experimental-worker index.js
Sorting [ 9, 4, 1, 6, 4, 9, 9, 10, 4, 3 ]
sleeping 9000
sleeping 4000
sleeping 1000
sleeping 4000
sleeping 6000
sleeping 9000
sleeping 9000
@stepankuzmin
stepankuzmin / needs_indexes.sql
Created January 16, 2019 19:38
Finding which tables need extra indexes
SELECT relname,
seq_scan,
seq_tup_read,
idx_scan
FROM pg_stat_user_tables
WHERE seq_scan > 0
ORDER BY 3 DESC LIMIT 10;
@stepankuzmin
stepankuzmin / getRandomColors.js
Created January 14, 2019 12:43
Generate random colors from palette
const randomColors = [
'#8dd3c7',
'#ffffb3',
'#bebada',
'#fb8072',
'#80b1d3',
'#fdb462',
'#b3de69',
'#fccde5',
'#d9d9d9',
@stepankuzmin
stepankuzmin / README.md
Created January 4, 2019 10:22
Gitlab AutoDevops on DigitalOcean k8s
@stepankuzmin
stepankuzmin / invalid.geojson
Created December 11, 2018 15:01
non rewindable geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- 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%}"
@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;
@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 / 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 / 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> {