Skip to content

Instantly share code, notes, and snippets.

View ybogdanov's full-sized avatar

Yuriy Bogdanov ybogdanov

View GitHub Profile

Привет. Меня зовут Дима Унковский, я – ведущий разработчик в команде Platform в Grammarly, и я ищу хороших DevOps ребят в нашу команду.

Что делает ваша команда?

Наша область ответственности – облачная инфраструктура, сопутствующие инструменты и инфраструктурные сервисы. Улучшая их, мы делаем все, чтобы продуктовым командам было удобнее разрабатывать и поддерживать продукт Grammarly.

Что делает компания? Как вы работаете?

@ybogdanov
ybogdanov / nginx.yml
Last active September 11, 2015 10:02
An example of decoupled nginx deployment with the use of rocker-compose. See http://tech.grammarly.com/blog/posts/How-We-Deploy-Containers-at-Grammarly.html
namespace: nginx
containers:
# "shared" is the data volume container that holds nginx config files and static html files for
# the "nginx" container. It is empty from the beginning, but once "configs" container is started
# files are copied to the "shared" container with rsync(1)
#
# This container is designed to be persistent across deploys of both "nginx" and "configs"
# containers.
#
@ybogdanov
ybogdanov / app.yml
Last active November 28, 2016 00:26
An example of a high-level application (service) manifest. See http://tech.grammarly.com/blog/posts/How-We-Deploy-Containers-at-Grammarly.html
# This is an example of a high-level application (service) that can run along with
# platform agents, write metrics and logs to them.
namespace: example
containers:
app:
image: alpine:3.2
# We wrote a simple program that on every tick prints the iterator,
# increments a metric in StatsD and writes a line to the log file
cmd: |-
@ybogdanov
ybogdanov / platform.yml
Last active November 28, 2016 00:26
A manifest that describes "platform" agents that we run on every instance. See http://tech.grammarly.com/blog/posts/How-We-Deploy-Containers-at-Grammarly.html
# This is a manifest that describes "platform" agents that we run on every instance.
# It includes auxilary services that work alongside with the application containers
# to provide logging and monitoring.
#
# This file looks a bit tough, but that's what happens when you meet the reality.
# We have also pruned it a bit to remove our company specifics.
#
# You may notice "env", "role" and "track" variables. We specify them as EC2 instance
# tags and pass them to rocker-compose on every run. This allows us to distinguish
# instances and do basic service discovery and A/B testing.
@ybogdanov
ybogdanov / Dockerfile
Last active September 7, 2015 16:59
Example Rockerfile with multiple FROM instructions, see https://github.com/grammarly/rocker
# Build stage: will start from google/golang:1.4 and compile app.go
FROM google/golang:1.4
ADD . /src
WORKDIR /src
# Will result in putting app.o to the working directory /src
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -v -o app.o app.go
# Will make app.o available in the following FROM
EXPORT app.o
# Describe "run" image based on "busybox", weights 4.3MB
@ybogdanov
ybogdanov / olx-previews.user.js
Created June 2, 2015 12:31
Makes OLX (slando) render large image previews
// ==UserScript==
// @name OLX Previews
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description Makes OLX (slando) render large image previews
// @match http://kiev.ko.olx.ua/nedvizhimost*
// @copyright 2015+, Yuriy Bogdanov
// ==/UserScript==
;(function(){
@ybogdanov
ybogdanov / erlang_brute.erl
Created October 12, 2011 01:19
brute force example on erlang
-module(brute).
-export([brute/1]).
brute_(N, M, _, O) when N == M ->
O;
brute_(N, M, L, O) ->
[string:right(integer_to_list(N), L, $0) | brute_(N + 1, M, L, O)].
brute(N) ->
brute_(0, math:pow(10, N), N, []).
@ybogdanov
ybogdanov / node-sync-express-mysql-transactions.js
Created August 30, 2011 15:23
how to use node-sync in express-middleware style with mysql transactions
// Заюзай node-sync v0.1.9beta2, в ней есть .asyncMiddleware()
// это маленькая магия, которая позволяет писать "синхронные" функции типа function(req, res, next)
// еще не знаю, как ее лучше назвать...
app.post('/q/register', function(req, res) {
var mysql = database.spawnConnection();
// А можно реализацию beginSync?
mysql.beginSync();
@ybogdanov
ybogdanov / createEdge-async-example.js
Created August 21, 2011 22:51
examples of code which uses node-async vs node-sync with more complex logic
createEdge : function(e, callback)
{
var self = this, tryNum = 0,
isolateRetryAttempts = 20,
isolateRetryInterval = 1000;
callback = callback || function(){};
if (!(e instanceof Edge) || !e.isValid()) {
return callback(new Error("Invalid edge passed"));
@ybogdanov
ybogdanov / getUserSummary_nodejs_async.js
Created August 20, 2011 13:19
nodejs callbackDriven vs node-async vs node-sync
function getUserSummary(userId, callback)
{
async.parallel({
user : function(callback) {
db.users.findUserById(userId, callback)
},
tweets : function(callback) {
db.users.getTweets(userId, callback)