Skip to content

Instantly share code, notes, and snippets.

Working from home

Eduard Larionov vesh95

Working from home
View GitHub Profile
vesh95 / qna.conf
Created Mar 19, 2020
monit + unicorn + sphinx + sidekiq
View qna.conf
## Nginx ###
check process nginx with pidfile /run/
start program = "/usr/sbin/service nginx start"
stop program = "/usr/sbin/service nginx stop"
if cpu > 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if memory usage > 80% for 5 cycles then restart
if failed host port 80 protocol http
then restart
if 3 restarts within 5 cycles then timeout
View sphinx_helper.rb
# frozen_string_literal: true
require 'rails_helper'
RSpec.configure do |config|
config.use_transactional_fixtures = false
# DatabaseCleaner settings
config.before(:suite) do
View tobashrc
#показ ветки в командной строке
parse_git_branch() {
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
echo "$git_branch"
PS1="${debian_chroot:+($debian_chroot)}\e[01;94mbranch:[\$(parse_git_branch)]\e[00m \e[02;31;01mjobs:\j\e[00m \e[01;32m\w\e[00m\n$: "
vesh95 / test-guru-question.txt
Created Jan 16, 2020
A question about Ruby from TestGuru
View test-guru-question.txt
Что вернёт метод select
Первый попавшийся элемент в массиве
Подмассив, соответствующий условию выборки
Количество подходящих элементов
Случайный массив
vesh95 / test-guru-question.txt
Created Jan 15, 2020
A question about ReactJS from TestGuru
View test-guru-question.txt
Что делает setState?
Обновляет состояние компонента
Возвращает текущее состояние компонента
View after-recieve
#! /bin/sh
mkdir -p $TMP_GIT_CLONE
View CRUD.sql
INSERT INTO categories (title) VALUES
INSERT INTO tests(title, level, categories_id) VALUES
('HTML', 1, 1),
('Rails', 2, 2),
('Django', 2, 2),
('MySQL', 3, NULL),
View get_anything
GET /anything HTTP/1.1
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Type: application/json
Date: Fri, 06 Dec 2019 13:57:33 GMT
Referrer-Policy: no-referrer-when-downgrade
Server: nginx
View rubocop_pre_commit_hook
#!/usr/bin/env ruby
ADDED_OR_MODIFIED = /^\s*(A|AM|M)/.freeze
changed_files = `git status --porcelain`.split(/\n/)
unstaged_files = `git ls-files -m`.split(/\n/)
changed_files = { |f| f =~ ADDED_OR_MODIFIED }
changed_files = { |f| f.split(" ")[1] }
You can’t perform that action at this time.