Skip to content

Instantly share code, notes, and snippets.


Michael Nikitochkin miry

View GitHub Profile
miry / Gemfile
Last active May 22, 2021
Sidekiq gracefull startup and shutdown in Kubernetes
View Gemfile
# frozen_string_literal: true
source ""
git_source(:github) { |repo_name| "{repo_name}" }
gem "sidekiq"
miry / .overcommit.yml
Last active May 8, 2021
Overcommit configuration for Crystal projects
View .overcommit.yml
# Sample configuration for to support Crystal projects
verify_signatures: false
# NOTE: LineEndings does not work with git versions < 2.x
# LineEndings:
# enabled: true
enabled: true
miry / materilize_view_migration.rb
Last active Mar 19, 2021
Example of Migration to create a table with cached results: Materialised view table
View materilize_view_migration.rb
class MaterialisedView < ActiveRecord::Migration[5.2]
def change
execute <<-SQL
CREATE TABLE mv_complex_query
COMMENT 'Updated every 5m by the mv_complex_query event'
SELECT * FROM big_table
execute <<-SQL
CREATE EVENT dump_mv_complex_query
miry / kube_clean_staging_deployment.yml
Created Feb 19, 2021
A Kube resources to automaticaly to remove old kube resources that were deployed to staging
View kube_clean_staging_deployment.yml
apiVersion: v1
kind: ServiceAccount
k8s-app: deployments-gc
name: deployments-gc
namespace: pnd-staging
miry / sidekiq_mem_killer.rb
Last active Feb 17, 2021
Gracefull sidekiq worker killer for kubenernetes clusters
View sidekiq_mem_killer.rb
require 'fileutils'
require 'open3'
# Usage:
# Sidekiq.configure_server do |config|
# config.server_middleware do |chain|
# chain.add MemoryKillerMiddleware if ENV['SIDEKIQ_MEMORY_KILLER_MAX_RSS']
# end
miry /
Last active Nov 13, 2020
Spacemacs layer OSX fast open file by name to add CMD+P to find a file by name
View duplication_in_block.rb
def method_one(&block)
puts "method_one"
def method_two(&block)
puts "method_two"
#!/usr/bin/env bash
medup -u miry -d ./posts/miry # Articles written by miry
medup -u miry -d ./posts/favorites -r # Favorite articles of miry (clapped one)
medup -u miry -d ./posts/miry --update # Update existing exported posts with latest versions of posts
medup # Export single article
medup # Export signle article with custom domain
miry / MOVIE
Last active Aug 12, 2020
Automate compressing of video files from GoPro
miry / 01_dynamodb_get_all.rb
Last active May 6, 2020
Sample to get all items from DynamoDB table
View 01_dynamodb_get_all.rb
# frozen_string_literal: true
require 'aws-sdk-dynamodb'
require 'hirb'
# NOTICE: Authorize via
dynamodb =
scan_opts = { table_name: '<TABLE_NAME>' }
items = []