Skip to content

Instantly share code, notes, and snippets.

View zwolf's full-sized avatar

Zach Wolfenbarger zwolf

View GitHub Profile
@zwolf
zwolf / clear_sidekiq_locks_redis_cli.sh
Created December 19, 2018 15:53 — forked from camallen/clear_sidekiq_locks_redis_cli.sh
Clear out sidekiq unique & congestion locks from redis
# ssh onto the redis node in question and run these cmds
# congestion:* keys are for https://github.com/parrish/Sidekiq-Congestion
# uniquejobs:* https://github.com/mhenrixon/sidekiq-unique-jobs
# get a count of the locks
redis-cli -n 0 --scan --pattern 'congestion:*' | wc -l
redis-cli -n 0 --scan --pattern 'uniquejobs:*' | wc -l
# clear them for both key namespaces
@zwolf
zwolf / project_classifications_csv_dump_export.rb
Created April 20, 2018 18:39 — forked from camallen/project_classifications_csv_dump_export.rb
Manual classification csv exports for a panoptes project
# Manual csv classifications dump
# ensure you have a manual secondary database connection specified in config/database.yml
#
# run via rails runner from the panoptes cmd line via
# rails r project_classifications_csv_dump_export.rb
require 'csv'
PROJECT_ID = 1
@zwolf
zwolf / pg_locks.sql
Created January 30, 2018 22:02 — forked from camallen/pg_locks.sql
Show info on postgres locks
SELECT bl.pid AS blocked_pid,
a.usename AS blocked_user,
ka.query AS current_statement_in_blocking_process,
now() - ka.query_start AS blocking_duration,
kl.pid AS blocking_pid,
ka.usename AS blocking_user,
a.query AS blocked_statement,
now() - a.query_start AS blocked_duration
FROM pg_catalog.pg_locks bl
JOIN pg_catalog.pg_stat_activity a ON a.pid = bl.pid
@zwolf
zwolf / pg_find_unused_indexes.sql
Created March 28, 2017 20:36 — forked from camallen/pg_find_unused_indexes.sql
PostgreSQL - find unused indexes
SELECT
relid::regclass AS table,
indexrelid::regclass AS index,
pg_size_pretty(pg_relation_size(indexrelid::regclass)) AS index_size,
idx_tup_read,
idx_tup_fetch,
idx_scan
FROM
pg_stat_user_indexes
JOIN pg_index USING (indexrelid)
@zwolf
zwolf / kibana4
Created October 1, 2015 22:02 — forked from thisismitch/kibana-4.x-default
ELK Kibana4
#!/bin/sh
#
# /etc/init.d/kibana4 -- startup script for kibana4
# [email protected] 2015-02-20; used elasticsearch init script as template
# https://github.com/akabdog/scripts/edit/master/kibana4_init
#
### BEGIN INIT INFO
# Provides: kibana4
# Required-Start: $network $remote_fs $named
# Required-Stop: $network $remote_fs $named