Skip to content

Instantly share code, notes, and snippets.


Andrey Chernykh andreychernih

View GitHub Profile
cat config/deploy/k8s/*.yml | envsubst | kubectl apply -f -
cat config/deploy/k8s/*.yml | envsubst | kubectl wait --for condition=available -f - --timeout 120s

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
andreychernih / search.feature
Created Sep 8, 2016
How to test a website blog post
View search.feature
Feature: Search
Scenario: Search for "apple"
Given I am on the front page
When I search for "apple"
Then I should see ""
andreychernih / Dockerfile
Created Aug 29, 2016
docker osxfs slowness workaround
View Dockerfile
ENV BUNDLE_APP_CONFIG /usr/local/bundle
ADD Gemfile $DIR
ADD Gemfile.lock $DIR
# Force bundler to install all gems to system location (/usr/local/bundle) so that when you run `rake` command
# all files are loaded from docker image instead of mounted volume
RUN bundle install --deployment --path $BUNDLE_APP_CONFIG
andreychernih / tester.rb
Created Oct 16, 2015
variable in ruby shadows method with the same name
View tester.rb
class Tester
def test
if false
# variable 'var' is now in scope because it's defined syntactically (at parse time)
var = 'bar'
# variable 'var' shadows method with the same name. variable 'var' was defined, but never assigned which means it equals nil
puts var.inspect # => nil
andreychernih / child.rb
Created Oct 9, 2015
Why rails can't infer foreign key name automatically?
View child.rb
class Child < ActiveRecord::Base
belongs_to :parent # Child has parent_guid field
# ActiveModel::MissingAttributeError:
# can't write unknown attribute `parent_id`
andreychernih / base.rb
Last active Sep 8, 2015
Interview test task
View base.rb
class Base
def initialize(attrs={})
# implement this
def self.find(id)
# implements this
def self.db
andreychernih / spec_helper.rb
Created May 7, 2015
TeamCity hack for running specs with spork started from another process (i.e. from terminal)
View spec_helper.rb
# Teamcity hack
$LOAD_PATH.push '/Applications/'
$LOAD_PATH.push '/Applications/'
require 'teamcity/spec/runner/formatter/teamcity/formatter'
andreychernih / Vagrantfile
Created Jan 8, 2015
Package plugins with vagrant
View Vagrantfile
needs_restart = false
plugins = {
'vagrant-aws' => '0.5.0',
'vagrant-s3auth' => '0.1.0',
'vagrant-bindfs' => '0.3.2',
plugins.each do |plugin, version|
unless Vagrant.has_plugin?(plugin)
system("vagrant plugin install #{plugin} --plugin-version #{version}") || exit!
needs_restart = true
andreychernih / script.js
Created Nov 20, 2014
Delete all Jenkins jobs produced by "Build Per Branch"
View script.js
for(job in jenkins.model.Jenkins.theInstance.getProjects()) {
if ( != 'project-test-master' &&'project-test') > -1) {