This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'elasticsearch' | |
require 'time' | |
client = Elasticsearch::Client.new host: "172.17.0.1", log: true | |
mappings = { | |
mappings: { | |
log: { | |
properties: { | |
ts: { type: 'date' }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'capybara' | |
require 'capybara/dsl' | |
require 'selenium-webdriver' | |
# java -jar selenium-server-standalone-3.14.0.jar | |
# | |
if ENV["SELENIUM_REMOTE_HOST"] | |
Capybara.register_driver :selenium_chrome_remote do |app| | |
args = [ | |
"--disable-infobars", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
set -e | |
root_dir=$(pwd) | |
tmpdir=$(mktemp -d "${TMPDIR:-/tmp/}$(basename $0).XXXXXXXXXXXX") | |
git archive --prefix=my-jet/ HEAD > "$tmpdir/archive.tgz" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowListingOfUserFolder", | |
"Action": [ | |
"s3:ListBucket", | |
"s3:GetBucketLocation" | |
], | |
"Effect": "Allow", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
delete_branches () { | |
branches=($(git branch | sed 's/*//g')) | |
element_count=${#branches[@]} | |
selected_branches=() | |
echo "Select branches:" | |
for br in "${branches[@]}" | |
do | |
echo "Delete $br ? y/(n)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find all .orig files, and delete them with confirmation | |
find . -name "*.orig" && read -q "REPLY?Delete all?" && find . -name "*.orig" -delete && echo "\nDone." | |
# pg_restore with bandwidth control and progress bar | |
cat db.dump | pv -pera -s $(stat -c %s db.dump) -L 2000000 | pg_restore -d postgres://postgres:a@localhost/db_name --clean --no-owner --verbose -Fc | |
# check pg readiness | |
for i in {1..60}; do echo "Waiting for pg ..."; pg_isready -d $PG_URL && break || sleep 1; done | |
# http://www.grymoire.com/Unix/Awk.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Copy from Vim to clipboard | |
vmap <leader>x :w! ~/.vbuf<cr>:!cat ~/.vbuf \| xclip -in -sel clip<cr><cr> | |
" Strip rspec outputs | |
:%s/rspec \(.\{-}\) #.\+/\1 \\/gc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_fork do | |
trap 'TTIN' do | |
Thread.list.each do |thread| | |
puts "\nThread TID-#{thread.object_id.to_s(36)}" | |
puts thread.backtrace.join("\n") | |
puts "\n" | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT nspname || '.' || relname AS "relation", | |
pg_size_pretty(pg_relation_size(C.oid)) AS "size" | |
FROM pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
WHERE nspname NOT IN ('pg_catalog', 'information_schema') | |
ORDER BY pg_relation_size(C.oid) DESC | |
LIMIT 200 -- bigtables; | |
SELECT | |
pg_stat_activity.pid, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
postgres: | |
image: postgres:9.6 | |
ports: | |
- "5432:5432" | |
environment: | |
POSTGRES_PASSWORD: a |
NewerOlder