Skip to content

Instantly share code, notes, and snippets.

@kirushik
kirushik / API_versioning.md
Last active March 19, 2021 16:00
API versioning for HTTP REST interfaces

API versioning for HTTP REST interfaces (best practices)

We at SCC Team (and at SUSE in general) are providing more and more APIs with the wonderful HTTP REST approach. APIs evolve over time, often unexpectedly — so it makes sense to get into some API versioning best practices right from the day 0. I was asked to join Crowbar guys' discussion to share my SCC experience with versioning APIs. This article is an attempt to formalize our solution and prepare it for a wider audience.

So, imagine you have different API consumers out of your area of control. Some of them definitely will lag behind the latest release.

@kirushik
kirushik / thesis.md
Last active November 18, 2016 12:54

Performance metrics, logging and monitoring for Docker-based deployments

Today every self-respecting developer thinks of microservices and containers. This approach significantly simplifies deployments and maintenance efforts, while shortening the development-to-production cycle length.

But there are some quite weakly addressed pain points on that route: we can reliably deploy a product as a swarm of weakly-linked containers, but we're lacking most of the usual tools to get insights of what's happening inside those containers|services, and how to debug and troubleshoot our production issues.

As a team in the middle of such transition, we at SCC have hit most of those issues:

  • Any incoming request requires several containers to work in unison. How to log that work so it's easy to retrieve everything what happened on all the affected nodes?
#!/usr/bin/env ruby
require 'find'
ACCESS_DENIED = ["$Recycle.Bin", "Documents and Settings", "Program Files", "Program Files (x86)", "ProgramData", ".", ".."]
def search(name, dirname = ".")
Find.find(dirname).find do |path|
! ACCESS_DENIED.include?(File.basename(path)) &&
! File.directory?(path) &&
File.basename(path) == name
@kirushik
kirushik / init.vim
Last active December 20, 2015 00:22
call plug#begin()
Plug 'junegunn/seoul256.vim'
Plug 'tpope/vim-sensible'
"Plug 'benekastah/neomake'
Plug 'Shougo/deoplete.nvim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'leafgarland/typescript-vim', { 'for': 'typescript' }
@kirushik
kirushik / Testing 100vh and flexbox.markdown
Created August 20, 2015 03:05
Testing 100vh and flexbox
@kirushik
kirushik / palindromes.rs
Last active August 29, 2015 14:19
Binary palindromes in Rust
fn bin_reverse(n_orig: u32) -> u32 {
let mut n = n_orig;
n = ((n & 0xFFFF0000) >> 16) | ((n & 0x0000FFFF) << 16 );
n = ((n & 0xFF00FF00) >> 8 ) | ((n & 0x00FF00FF) << 8 );
n = ((n & 0xF0F0F0F0) >> 4 ) | ((n & 0x0F0F0F0F) << 4 );
n = ((n & 0xCCCCCCCC) >> 2 ) | ((n & 0x33333333) << 2 );
n = ((n & 0xAAAAAAAA) >> 1 ) | ((n & 0x55555555) << 1 );
n
@kirushik
kirushik / palindromes.ex
Created April 18, 2015 12:06
Binary palindromes
defmodule Palindrome do
def is_palindrome(x) do
y = x |> Integer.to_char_list(2)
y == Enum.reverse y
end
end
1900..2100 |> Enum.filter &Palindrome.is_palindrome/1
# Based on idan's script
function _git_branch_name
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _is_git_dirty
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
@kirushik
kirushik / package.mk
Last active August 29, 2015 14:03
package.mk to add ets-cache into RabbitMQ build (should be placed in umbrella/ets-cache)
APP_NAME:=ets_cache
UPSTREAM_GIT:=https://github.com/blinkov/ets-cache.git
UPSTREAM_REVISION:=96e9a2a7c16127b8f4d0bdb279e28bd5600e4265
RETAIN_ORIGINAL_VERSION:=true
ORIGINAL_APP_FILE=$(CLONE_DIR)/src/$(APP_NAME).app.src
DO_NOT_GENERATE_APP_FILE=true
#!/bin/bash
REPO_ROOT=/srv/repo
PACKAGES_LOCATION=pool
METAINFO_LOCATION=$REPO_ROOT/dists/ubuntu/
RELEASE_FILE=$METAINFO_LOCATION/Release
PACKAGES_FILE=$METAINFO_LOCATION/testing/binary-amd64/Packages
cd $REPO_ROOT