Skip to content

Instantly share code, notes, and snippets.

View palkan's full-sized avatar
🗺️
RailsConf / RubyKaigi

Vladimir Dementyev palkan

🗺️
RailsConf / RubyKaigi
View GitHub Profile
@palkan
palkan / postgres_queries_and_commands.sql
Last active December 5, 2019 13:01 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- kill running query
SELECT pg_cancel_backend(procpid);
-- kill idle query
@avlazarov
avlazarov / grpc.conf
Last active August 23, 2019 14:51
AnyCable gRPC connection issue
upstream grpcservers {
server 0.0.0.0:50051;
server 0.0.0.0:50052;
}
server {
listen 50050 http2;
server_name localhost;
access_log /var/log/nginx/grpc_log.json;
@Earendil95
Earendil95 / task_hooks.md
Last active August 8, 2019 17:12
Git hooks for automatic reference issues in commit

Description

This hooks will remind you to reference task in your commit, and remember your task ref for branch. Your commit messages will have style "[reference] message"

Usage

  1. Create two files in your repo - e.g. [PROJECT_ROOT]/hooks/prepare-commit-msg.rb and [PROJECT_ROOT]/hooks/post-checkout.rb
  2. Copy to first file (here will assume that this is a [PROJECT_ROOT]/hooks/prepare-commit-msg.rb):
#!/usr/bin/env ruby
module ApplicationPolicy
READ = :read
MANAGE = :manage
MANAGE_FIELD = { parent_role: MANAGE } # NOTE(rstankov): Used for GraphQL fields
UPDATE = :update
MODERATE = :moderate
class Object
def defer(method, *args)
@current_fibers ||= []
@tracepoint ||= TracePoint.trace(:return) do |tp|
@current_fibers.reverse_each do |fib|
fib.resume
end
end
@current_fibers << Fiber.new do
@cheeaun
cheeaun / rdrc2017.md
Last active October 11, 2017 06:56
RedDotRubyConf 2017 links & resources 😘