Skip to content

Instantly share code, notes, and snippets.

View zwolf's full-sized avatar

Zach Wolfenbarger zwolf

View GitHub Profile
@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
Adam: https://open.spotify.com/user/spotifydiscover/playlist/0f4h4WmPq27eYrXCz93Ncj
Zach: https://open.spotify.com/user/spotifydiscover/playlist/4oovRX5zvmhuzC3uX7Es8v
Chris: https://open.spotify.com/user/spotifydiscover/playlist/0FsK5ub7IXpa7J78t03uth
Sascha: https://open.spotify.com/user/spotifydiscover/playlist/4NfabV5DBk1RdMQOUiRIiE
Cam: https://open.spotify.com/user/spotifydiscover/playlist/7KnDkFHwq8BY6WAMbdB8Wf
Sarah: https://open.spotify.com/user/spotifydiscover/playlist/7EFdKTPZKnzbrTj8wf4YMG
Becky: https://open.spotify.com/user/spotify/playlist/37i9dQZEVXcS4Wh3BmdREX
@zwolf
zwolf / pre-commit
Last active December 15, 2016 10:27
A pre-commit hook for git to alert if ":focus" (or similar) is found in a + line of a diff
#!/usr/bin/env ruby
if `git diff HEAD spec` =~ /^\+.*,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/
puts "\e[31mPlease focus and remove your :focus tags before committing :)"
exit 1
end
@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 / gist:f2d5f5f08ff8e683ba7730f8dddfb804
Created June 1, 2017 19:24
phageParser PEP-8 statistics
[02:23:06 (master) ~/mozilla/phageParser]$ pep8 --statistics -qq ./
4 E101 indentation contains mixed spaces and tabs
2 E111 indentation is not a multiple of four
1 E124 closing bracket does not match visual indentation
6 E201 whitespace after '['
1 E202 whitespace before ']'
12 E211 whitespace before '('
5 E221 multiple spaces before operator
8 E222 multiple spaces after operator
32 E225 missing whitespace around operator
@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 / workflow_task.json
Created February 26, 2018 18:03
Workflow 5919 task definition
{
"id": 5919,
"display_name": "Descriptive book",
"tasks": {
"T1": {
"next": "T2",
"type": "combo",
"tasks": [
"T5",
"T7",
@zwolf
zwolf / malformed_annotation.json
Created February 26, 2018 18:07
Malformed annotation
[
{
"task": "T1",
"value": [
{
"task": "T5",
"value": "John Adams"
},
{
"task": "T7",
@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 / 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