start new:
tmux
start new with session name:
tmux new -s myname
| columns_that_make_record_distinct = [:some_id, :another_name] | |
| distinct_ids = Model.select("MIN(id) as id").group(columns_that_make_record_distinct).map(&:id) | |
| duplicate_records = Model.where.not(id: distinct_ids) |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- 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%' |
| # let's dig the server | |
| dig example.com | |
| # from the DNS answer we are interested in the authority section | |
| #;; AUTHORITY SECTION: | |
| #example.com. 79275 IN NS a.iana-servers.net. | |
| #example.com. 79275 IN NS b.iana-servers.net. | |
| # now we find out all subdomains | |
| dig @a.iana-servers.net example.com axfr |
| require 'net/http' | |
| require 'json' | |
| require 'uri' | |
| @token = '' | |
| def list_files | |
| ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago | |
| params = { | |
| token: @token, |
| # Copyright (c) 2014 Lukas Fittl <lukas@pganalyze.com> | |
| # | |
| # Released in the public domain - fork as you wish. | |
| require 'rubygems' | |
| require 'mixlib/cli' | |
| require 'pg' | |
| require 'pg_query' | |
| require 'curses' |
| stats = Sidekiq::Stats.new | |
| stats.queues | |
| stats.enqueued | |
| stats.processed | |
| stats.failed |
| #!/usr/bin/env bash | |
| # | |
| # License: Apache-2.0 | |
| # | |
| # Description: Convert go-kit/log to slog calls | |
| # | |
| # Authors: | |
| # - Ben Kochie (@superq) | |
| # - TJ Hoplock (@tjhop) | |
| # |