Skip to content

Instantly share code, notes, and snippets.

View georgiybykov's full-sized avatar
💥
...creating a code

Georgiy Bykov georgiybykov

💥
...creating a code
  • Saint-Petersburg
View GitHub Profile
@georgiybykov
georgiybykov / Capfile
Created October 2, 2021 23:21
Unicorn configuration for deploying application to production with capistrano
# frozen_string_literal: true
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails'
@georgiybykov
georgiybykov / qna.monit.rc
Last active October 3, 2021 03:48
nginx, unicorn, postgresql, redis, sidekiq, elasticsearch configs for monit
# /etc/monit/conf-enabled/qna.monit.rc
### Nginx ###
check process nginx with pidfile /run/nginx.pid
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 65.108.50.164 port 80 protocol http
@georgiybykov
georgiybykov / elixir.yml
Created November 24, 2021 21:35
GitHub Actions for Elixir
# .github/workflows/elixir.yml
---
name: build
on: [push, pull_request]
jobs:
all_jobs:
runs-on: ubuntu-latest
@georgiybykov
georgiybykov / elixir.yml
Created November 24, 2021 21:37
GitHub Actions for Elixir (extended version with shared dependencies)
# .github/workflows/elixir.yml
---
name: build
on: [push, pull_request]
jobs:
dependencies:
runs-on: ubuntu-latest
@georgiybykov
georgiybykov / explicit_locking.md
Last active March 29, 2022 22:37
SQL queries with transactions

1st console:

udatapp_development=# begin;
BEGIN

udatapp_development=# lock table users in access exclusive mode;
LOCK TABLE

udatapp_development=# 
@georgiybykov
georgiybykov / eager_load_config_for_environments.rb
Last active September 5, 2022 22:10
Eager Load configuration
# EagerLoad.configure.enabled = true
#
# EagerLoad.configure_for_environments do |env|
# env.development = false
# env.staging = true
# env.production = true
# end
#
# EagerLoad.enabled?
# frozen_string_literal: true
require 'docx'
module Docx
# docs
class Differences
class << self
# @param file_paths [Array<String>] ARGV with absolute files pathes
# @return [Array<Hash>]