Skip to content

Instantly share code, notes, and snippets.

View viktor-evdokimov's full-sized avatar
👷‍♂️
Focusing

Viktor Evdokimov viktor-evdokimov

👷‍♂️
Focusing
View GitHub Profile
@viktor-evdokimov
viktor-evdokimov / git-reup
Created May 24, 2017 01:08 — forked from righi/git-reup
git-reup
#!/usr/bin/env ruby
#
# Usage: git-up
# git-reup
#
# Like git-pull but show a short and sexy log of changes
# immediately after merging (git-up) or rebasing (git-reup).
#
# Inspired by Kyle Neath's `git up' alias:
# http://gist.github.com/249223
@viktor-evdokimov
viktor-evdokimov / postres.sql
Last active May 10, 2017 15:09
recursive CTE to get next 10 days
;with recursive t(n) as ( SELECT now() n union all select n + '1 day' from t where n < '2033-01-01') select * from t limit 10;
-- also this works
;with recursive t(n) as ( SELECT now() n union all select n + '1 day' from t) select * from t limit 1000;
@viktor-evdokimov
viktor-evdokimov / postgres-cheatsheet.md
Created May 10, 2017 14:41 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@viktor-evdokimov
viktor-evdokimov / main.go
Created February 11, 2017 00:46 — forked from ssimunic/main.go
Monitor web page changes with Go
package main
import (
"net/http"
"io/ioutil"
"time"
"log"
"os"
)
@viktor-evdokimov
viktor-evdokimov / scheduler.ex
Created November 10, 2016 13:55 — forked from danielberkompas/scheduler.ex
A simple mix task scheduler for Elixir apps
defmodule MyApp.Scheduler do
@moduledoc """
Schedules a Mix task to be run at a given interval in milliseconds.
## Options
- `:task`: The name of the Mix task to run.
- `:args`: A list of arguments to pass to the Mix task's `run/1` function.
- `:interval`: The time interval in millisconds to rerun the task.
@viktor-evdokimov
viktor-evdokimov / app.py
Created November 2, 2016 20:30 — forked from developer-rakeshpaul/app.py
Falcon App start up file with Flask like routes
import falcon
import os
from app.db import db_session
from app.utils.exceptions import build_error_response
from app.startup import (autoload, add_routes)
wsgi_app = falcon.API(after=[db_session.remove_session])
autoload("{0}/{1}".format(os.path.dirname(__file__), "handlers"))
@viktor-evdokimov
viktor-evdokimov / Dockerfile
Created October 28, 2016 03:13
next.js docker deployment
FROM node:6-onbuild
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install
COPY . /usr/src/app
#next specific build
RUN npm run build
@viktor-evdokimov
viktor-evdokimov / DDD CQRS ES Architecture videos.md
Last active October 25, 2016 22:19 — forked from SzymonPobiega/gist:5220595
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@viktor-evdokimov
viktor-evdokimov / zipper.scala
Last active October 19, 2016 14:26 — forked from hoheinzollern/zipper.scala
Zipper scala implementation
sealed abstract class Tree[A]
case class Item[A] (item: A) extends Tree[A]
case class Section[A] (s: List[Tree[A]]) extends Tree[A]
sealed abstract class Path[A]
case class Top[A] extends Path[A]
case class Node[A] (l: List[Tree[A]], p: Path[A], r: List[Tree[A]]) extends Path[A]
case class Location[A] (t: Tree[A], p: Path[A])
@viktor-evdokimov
viktor-evdokimov / join.swift
Last active September 22, 2016 21:31
time pre/post in swift
var ints: [String] = []
for i in 0...10000 {
ints.append(String(i))
}
var str = "start " + ints.joined(separator:" ")
print(str)