Skip to content

Instantly share code, notes, and snippets.

View zinovyev's full-sized avatar

Zinovyev Ivan zinovyev

View GitHub Profile
@zinovyev
zinovyev / docker_stats_json.sh
Created September 28, 2018 12:47
Output docker stats as json
docker stats --no-stream --no-trunc --format '{ "container": "{{ .Container }}", "name": "{{ .Name }}", "id": "{{ .ID }}", "cpu_perc": "{{ .CPUPerc }}", "mem_usage": "{{ .MemUsage }}", "net_io": "{{ .NetIO }}", "block_io": "{{ .BlockIO }}", "mem_perc": "{{ .MemPerc }}", "pids": "{{ .PIDs }}" }'
@zinovyev
zinovyev / gitlab-runner-commands.sh
Last active May 24, 2022 11:19
Unregister gitlab runner
## Remove a runner
sudo gitlab-runner list # To get a list of existing runners
sudo gitlab-runner verify --delete --url $YOUR_GITLAB_DOMAIN --token $YOUR_GITLAB_RUNNER_TOKEN
## Register a docker runner
sudo gitlab-runner register \
--non-interactive \
@zinovyev
zinovyev / devise.ru.yml
Created March 29, 2018 14:08 — forked from Vetal4eg/devise.ru.yml
Russian I18n locale for devise.
# Русский перевод для https://github.com/plataformatec/devise/tree/v4.3.0
# Другие переводы на http://github.com/plataformatec/devise/wiki/I18n
ru:
devise:
confirmations:
confirmed: "Ваша учётная запись подтверждена."
send_instructions: "В течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи."
send_paranoid_instructions: "Если ваш электронный адрес есть в нашей базе данных, то в течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи."
failure:
@zinovyev
zinovyev / docker_cleanup.sh
Last active December 14, 2017 10:30
Remove docker containers with duplicating images
docker ps -a | grep -v "Up" | sort -k2 | awk '{ if (prev_image==$2) { print "docker rm -f "$1 } ; prev_image=$2 }' | bash
@zinovyev
zinovyev / The Technical Interview Cheat Sheet.md
Created November 8, 2017 22:40 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@zinovyev
zinovyev / 00000000000000_remove_tables.rb
Created November 1, 2017 09:54
A pirate's way of removing several tables in one migration
class FixJenkinsMigration3 < ActiveRecord::Migration
self.disable_ddl_transaction!
TABLE_NAMES = %i[table_1 table_2 table_3]
def up
TABLE_NAMES.each do |table|
if ActiveRecord::Base.connection.table_exists? table
select_indexies(table).each do |index|
begin
remove_index(table, name: index)
@zinovyev
zinovyev / userContent.css
Created September 29, 2017 19:22
UserContent for a dark FF theme (./mozilla/firefox/some-hash.default/chrome/userContent.css)
input:not(.urlbar-input):not(.textbox-input):not(.form-control):not([type='checkbox']) {
-moz-appearance: none !important;
background-color: white;
color: black;
}
#downloads-indicator-counter {
color: white;
}
@zinovyev
zinovyev / json-rb.vim
Last active September 18, 2017 12:27
Format JSON in VIM through a filter on Ruby
" Format JSON
function JsonFormat()
execute(':%! ruby -rjson -e "print JSON.pretty_generate(JSON.parse(ARGF.read))"')
endfunction
command JsonFormat call JsonFormat()
@zinovyev
zinovyev / archlinux_ruby_2.3.3.rb
Created May 10, 2017 10:23
Installing ruby 2.3.3 under Archlinux with proper openssl version
sudo pacman -S openssl-1.0
cd /path/to/your/ruby/sources
CPPFLAGS="-I/usr/include/openssl-1.0" LIBS="-L/usr/lib/openssl-1.0" ./configure && make
sudo make install
@zinovyev
zinovyev / htmldoc
Created February 27, 2017 04:08
Pandoc proper html file generation. Example: `htmldoc README`.
#! /usr/bin/env bash
pandoc "$1.md" -o "$1.html"
echo -e "<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>$1</title></head><body>\n$(cat $1.html)\n</body></html>" > "$1.html"