Skip to content

Instantly share code, notes, and snippets.

View akurkin's full-sized avatar

Alex Kurkin akurkin

View GitHub Profile
akurkin / gist:dfb4662ca8740581265d195c0a32e758
Created September 3, 2018 19:06 — forked from mprymek/gist:8379066
Elixir metaprogramming example
# 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 July 13, 2018 15:41 — 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.
*** 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 July 25, 2017 20:19 — 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 November 23, 2016 12:41 — 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 June 21, 2016 17:36 — forked from alexey-milovidov/rounding_dates.txt
Example of using date and datetime functions in ClickHouse.
:) 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 June 21, 2016 17:35 — forked from alexey-milovidov/rounding_time.txt
Example of rounding time to 5-second interval in ClickHouse.
:) 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 June 19, 2016 18:27 — forked from alexey-milovidov/example.txt
Example of sequenceMatch aggregate function usage in ClickHouse.
$ 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,
akurkin / nested.sql
Last active October 23, 2023 07:05 — forked from alexey-milovidov/nested.txt
Example of Nested data type in ClickHouse.
:) 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 /
Last active August 26, 2015 22:00 — 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.

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