Skip to content

Instantly share code, notes, and snippets.

🔴
Offline

Sergey Ponomarev sponomarev

🔴
Offline
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
sponomarev / README.md
Created Oct 29, 2018 — forked from joyrexus/README.md
Functional config in go
View README.md

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
sponomarev / context.go
Created Oct 17, 2018
Context with Signal
View context.go
package cmd
import (
"context"
"os"
"os/signal"
"syscall"
)
// ContextWithSignal creates a context canceled when SIGINT or SIGTERM are notified
@sponomarev
sponomarev / main.go
Created Sep 24, 2018
Golang context to cancel HTTP request and response
View main.go
package main
import (
"context"
"fmt"
"io"
"log"
"net/http"
"time"
)
View howlong.rb
#!/usr/bin/env ruby
require 'time'
start = Time.now
ARGF.read.each_line do |line|
now = Time.now
prev ||= now
$stdout.puts "#{now.iso8601} #{ now - start }s #{ now - prev }s #{line}"
@sponomarev
sponomarev / alias_matchers.md
Created Jul 10, 2018 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3
View alias_matchers.md

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
1password
adobe-acrobat-reader
atom
blockblock
coconutbattery
cyberduck
daisydisk
dashlane
deluge
docker
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, blockeda.pid AS blocked_pid, blockeda.query AS blocked_query, blockedl.mode AS blocked_mode, blockinga.pid 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 blockedl.pid = blockeda.pid
JOIN pg_catalog.pg_locks blockingl ON( ((blockingl.transactionid=blockedl.transactionid)
OR (blockingl.relation=blockedl.relation
AND blockingl.locktype=blockedl.locktype) )
AND blockedl.pid != blockingl.pid)
JOIN pg_stat_activity blockinga ON blockingl.pid = blockinga.pid
AND blockinga.datid = blockeda.datid
@sponomarev
sponomarev / rinkeby.txt
Last active Aug 16, 2017
My Rinkeby testnet address
View rinkeby.txt
0x6aCD39459093E3d0D44e70878c52EE2ab047F5ba
You can’t perform that action at this time.