Skip to content

Instantly share code, notes, and snippets.


Sergey Ponomarev sponomarev

Block or report user

Report or block sponomarev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1b50484a8aeae9e01b39564e28721001
DELETE users
DELETE users_1_dedicated
# Create users index template
PUT _template/users
"index_patterns": ["users*"],
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
sponomarev /
Created Oct 29, 2018 — forked from joyrexus/
Functional config in go

Quick demo of how to initialize your data structure with optional configuration parameters ... with sane defaults if left unspecified.

This functional config technique ...

  • lets you write APIs that can evolve without pain
  • provides meaningful configuration parameters
  • makes it easy to set default settings
  • makes it possible to set complex conditional values
sponomarev / context.go
Created Oct 17, 2018
Context with Signal
View context.go
package cmd
import (
// ContextWithSignal creates a context canceled when SIGINT or SIGTERM are notified
sponomarev / main.go
Created Sep 24, 2018
Golang context to cancel HTTP request and response
View main.go
package main
import (
View howlong.rb
#!/usr/bin/env ruby
require 'time'
start = do |line|
now =
prev ||= now
$stdout.puts "#{now.iso8601} #{ now - start }s #{ now - prev }s #{line}"
sponomarev /
Created Jul 10, 2018 — forked from JunichiIto/
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
View 1password
View lock_monitor.sql
CREATE VIEW lock_monitor AS
(SELECT COALESCE(blockingl.relation::regclass::text,blockingl.locktype) AS locked_item, now() - blockeda.query_start AS waiting_duration, AS blocked_pid, blockeda.query AS blocked_query, blockedl.mode AS blocked_mode, AS blocking_pid, blockinga.query AS blocking_query, blockingl.mode AS blocking_mode
FROM pg_catalog.pg_locks blockedl
JOIN pg_stat_activity blockeda ON =
JOIN pg_catalog.pg_locks blockingl ON( ((blockingl.transactionid=blockedl.transactionid)
OR (blockingl.relation=blockedl.relation
AND blockingl.locktype=blockedl.locktype) )
AND !=
JOIN pg_stat_activity blockinga ON =
AND blockinga.datid = blockeda.datid
sponomarev / rinkeby.txt
Last active Aug 16, 2017
My Rinkeby testnet address
View rinkeby.txt
You can’t perform that action at this time.