Skip to content

Instantly share code, notes, and snippets.


Alex Kurkin akurkin

View GitHub Profile
akurkin / nested.sql
Last active Jul 14, 2022 — forked from alexey-milovidov/nested.txt
Example of Nested data type in ClickHouse.
View nested.sql
:) CREATE TABLE test.nested (EventDate Date, UserID UInt64, Attrs Nested(Key String, Value String)) ENGINE = MergeTree(EventDate, UserID, 8192)
CREATE TABLE test.nested
EventDate Date,
UserID UInt64,
Attrs Nested(
Key String,
Value String)
) ENGINE = MergeTree(EventDate, UserID, 8192)
akurkin / gist:dfb4662ca8740581265d195c0a32e758
Created Sep 3, 2018 — forked from mprymek/gist:8379066
Elixir metaprogramming example
View gist:dfb4662ca8740581265d195c0a32e758
# This is an example of metaprogramming in the Elixir language.
# We will define a domain specific language (DSL) for the definition
# of a service which is watched by several sensors.
# Each sensor watches some property/functionality of the service and
# returns the result of the check.
# To determine if the service is functioning properly, we need functions
# to run all the sensors' code and gather the returned data.
akurkin / instructions.txt
Created Jul 13, 2018 — forked from nathanborror/instructions.txt
Example Kubernetes setup with Postgres and two Services for serving an API and a static site using Ingress. Also have a CronJob example for kicks.
View instructions.txt
*** Cluster Setup for Google Container Engine ***
0/ Install and configure local gcloud and kubectl:
> gcloud components install kubectl
1/ Configure Google Cloud account:
> gcloud config set account YOUR_EMAIL_ADDRESS
> gcloud config set project YOUR_PROJECT_ID
> gcloud config set compute/zone us-west1-a
> gcloud config set container/cluster example
akurkin /
Created Jul 25, 2017 — forked from bastman/
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see:

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

akurkin /
Created Nov 23, 2016 — forked from gdamjan/
Setup for an easy to use, simple reverse http tunnels with nginx and ssh. It's that simple there's no authentication at all. The end result, a single ssh command invocation gives you a public url for your web app hosted on your laptop.


A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.

Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).


akurkin / rounding_dates.txt
Created Jun 21, 2016 — forked from alexey-milovidov/rounding_dates.txt
Example of using date and datetime functions in ClickHouse.
View rounding_dates.txt
:) SELECT toMonday(EventDate) AS k, count(), uniq(UserID) FROM hits_layer WHERE CounterID = 29761725 AND EventDate >= '2016-05-01' GROUP BY k ORDER BY k
toMonday(EventDate) AS k,
FROM hits_layer
WHERE (CounterID = 29761725) AND (EventDate >= '2016-05-01')
akurkin / rounding_time.txt
Created Jun 21, 2016 — forked from alexey-milovidov/rounding_time.txt
Example of rounding time to 5-second interval in ClickHouse.
View rounding_time.txt
:) SELECT toDateTime(intDiv(toUInt32(EventTime), 5) * 5) AS k, count(), uniq(UserID) FROM hits_layer WHERE CounterID = 29761725 AND EventDate = today() AND EventTime >= now() - 600 GROUP BY k ORDER BY k
toDateTime(intDiv(toUInt32(EventTime), 5) * 5) AS k,
FROM hits_layer
WHERE (CounterID = 29761725) AND (EventDate = today()) AND (EventTime >= (now() - 600))
akurkin / example.txt
Created Jun 19, 2016 — forked from alexey-milovidov/example.txt
Example of sequenceMatch aggregate function usage in ClickHouse.
View example.txt
$ clickhouse-client
ClickHouse client version 0.0.53720.
Connecting to localhost:9000.
Connected to ClickHouse server version 1.1.53981.
:) CREATE TABLE test.funnel (userID UInt64, eventType Enum8('A' = 1, 'B' = 2), EventTime Date, Age UInt8) ENGINE = Memory
CREATE TABLE test.funnel
userID UInt64,

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

akurkin /
Last active Aug 26, 2015 — forked from joelhooks/
It seems trivial to record a 1-8 minute screencast, but there are actually quite a few moving parts when it comes to recording a **high quality** screencast. Here's some of our thoughts on the subject.

Recording a Great Coding Screencast

The Screen

First and foremost a coding screencast is about the code, and we need to make sure it looks great. There are a few aspects to this that help ensure that is the case.


720p is the target resolution. In pixel terms this is 1280x720. We've gotten the best results when we record at 2560x1440 in a HiDPI (pixel double) mode, giving an effective visible resolution of 1280x720, but extremely crisp. This resolution is achievable on 27" monitors and retina MBPs.