Skip to content

Instantly share code, notes, and snippets.

akurkin / nested.sql
Last active Jun 29, 2019 — 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 / common.yml
Last active Mar 10, 2017
ROSI docker-compose.yml
View common.yml
# Shared definition of ruby microservice
command: "runsvdir /etc/service"
PORT: 3000
RAILS_ENV: development
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,
akurkin /
Last active May 20, 2016
List of open source Ember 2.x applications

Elegant and beautifully implemented Ember 2.x applications.

Each app and repo is a perfect example to poke around when learning Ember 2.x framework

Ember 2.x, Ember Data github repo (same repo for both frontend and backend)

  • OAuth2
  • JSONAPIAdapter