Skip to content

Instantly share code, notes, and snippets.

View stepankuzmin's full-sized avatar
🥡

Stepan Kuzmin stepankuzmin

🥡
View GitHub Profile
@stepankuzmin
stepankuzmin / test_.py
Created June 26, 2019 15:54
aiohttp + pytest + unittest mock
import aiohttp
from asyncio import Future
from unittest.mock import MagicMock, Mock, patch
def test_taxi_route_info(aiohttp_client, loop):
async def taxi_route_info():
connector = aiohttp.TCPConnector(ssl=False)
session = aiohttp.ClientSession(connector=connector, loop=loop)
taxi_route_info = TaxiRouteInfo(session=session)
@stepankuzmin
stepankuzmin / README.md
Created June 27, 2019 17:52
Filter highways from OSM extract
wget http://download.geofabrik.de/russia-latest.osm.pbf
osmconvert russia-latest.osm.pbf -o=russia-latest.o5m
osmfilter russia-latest.o5m --keep="highway=*" > russia-highways.osm
@stepankuzmin
stepankuzmin / ViewController.swift
Created August 5, 2019 08:41
XCode iOS WebKit WebView
//
// ViewController.swift
// SuperApp-iOS
//
// Created by Stepan Kuzmin on 05/08/2019.
// Copyright © 2019 Stepan Kuzmin. All rights reserved.
//
import UIKit
import WebKit
@stepankuzmin
stepankuzmin / urbica.zsh-theme
Created August 19, 2019 12:01
Urbica zsh theme
# -*- sh -*- vim:set ft=sh ai et sw=4 sts=4:
# It might be bash like, but I can't have my co-workers knowing I use zsh
PROMPT='%{$fg[green]%}%n@%{$fg[red]%}%m:%{$fg_bold[blue]%}%2~ $(git_prompt_info)%{$reset_color%}%(!.#.$) '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}"
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"extends": [
"airbnb",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
@stepankuzmin
stepankuzmin / README.md
Created September 26, 2019 08:09
Selectel + Let’s Encrypt Certbot

Selectel + Let’s Encrypt Certbot

Manual issue certificate:

sudo certbot certonly \
	--agree-tos \
	--email [email protected] \
	--manual \
	-d domain.tld
@stepankuzmin
stepankuzmin / expand.js
Last active November 10, 2019 13:59
Expand PostgreSQL hstore columns into plain columns with NodeJS
const { Pool, Client } = require('pg');
const groupBy = require('lodash.groupby');
const pool = new Pool({
host: 'localhost',
database: 'db'
});
const oldPoolQuery = pool.query;
pool.query = (...args) => {
@stepankuzmin
stepankuzmin / GPG and git on macOS.md
Created October 11, 2019 12:14 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
onMoveEnd = (event) => {
const map = this._mapRef.current.getMap();
map.off('moveend', this.onMoveEnd);
const zoom = map.getZoom();
const { lat, lng } = map.getCenter();
const viewport = { longitude: lng, latitude: lat, zoom };
this.props.onViewportChange(viewport);
};
type Immutable<T> = {
readonly [K in keyof T]: Immutable<T[K]>;
};