Skip to content

Instantly share code, notes, and snippets.

@meznak
meznak / chbs.sh
Last active Oct 13, 2020
CLI passphrase generator
View chbs.sh
#!/usr/bin/env bash
#####
# Passphrase generator a la Diceware and XKCD
#
# Usage:
# chbs.sh [word count] [phrase count]
#
# https://gist.github.com/meznak/f230e36d7d8f8cbbf62a9a80a9eff0d7
# https://xkcd.com/936/
@meznak
meznak / paloalto.conf
Created Apr 12, 2019
Palo Alto config for syslog-ng
View paloalto.conf
### Palo Alto
#
#############################################################################
### Sources
#
# Don't specify an IP so we listen on all.
# Tuning: https://codeascraft.com/2012/08/13/performance-tuning-syslog-ng/
# log-fetch-limit = number of lines from source in a "chunk"
# log-iw-size = max-connections * log-fetch-limit
# log-fifo-size = log-iw-size * 20 (set globally above)
@meznak
meznak / f5-dos.conf
Created Apr 12, 2019
F5 DOS config file for syslog-ng
View f5-dos.conf
#############################################################################
### F5 DOS
############################################################################
### Sources
# Multiple sources means using multiple threads, so split them up as much
# as possible!
# Don't specify an IP so we listen on all.
# Tuning: https://codeascraft.com/2012/08/13/performance-tuning-syslog-ng/
@meznak
meznak / bundlestatus.alias
Last active Feb 7, 2022 — forked from xoff00/gist:fc8e074985e48287e31742730d8a3e8b
Splunk cluster bundle status on a single line
View bundlestatus.alias
# Check indexer cluster bundle status without all the mess.
# Requires $SPLUNK_HOME/bin to be in your path
# one-shot status
alias bundlestatus="splunk show cluster-bundle-status > .cbs.tmp && sed -n '/cluster_status/,/^ *$/p' .cbs.tmp && grep -A5 site1 .cbs.tmp | paste -d ' ' - - - - - - - | sed -r -e 's/\t/ /g' -e 's/(.uto)?.asu.edu//g' -e 's/[[:alnum:]]\{8\}(-[[:alnum:]]\{4\}){3}-[[:alnum:]]\{12\}//g' -e 's/[[:blank:]]*site1[[:blank:]]*/ /g' -e 's/_bundle=(.{8}|.)\S*/=\1/g' -e 's/_validat(ed|ion_)//g' -e 's/_required_apply//g' -e 's/last_bundle//g' -e 's/--//g' | sort -V | column -t && rm .cbs.tmp"
# watch status
alias bundlestatusw="watch -n10 \"splunk show cluster-bundle-status > .cbs.tmp && sed -n '/cluster_status/,/^ *$/p' .cbs.tmp && grep -A5 site1 .cbs.tmp | paste -d ' ' - - - - - - - | sed -r -e 's/\t/ /g' -e 's/(.uto)?.asu.edu//g' -e 's/[[:alnum:]]\{8\}(-[[:alnum:]]\{4\}){3}-[[:alnum:]]\{12\}//g' -e 's/[[:blank:]]*site1[[:blank:]]*/ /g' -e 's/_bundle=(.{8}|.)\S*/=\1/g' -e 's/_validat(ed|ion_)//g'
@meznak
meznak / splunkbase_skipper.js
Created Mar 28, 2018
Skip the obnoxious "agree" dialog when downloading from Splunkbase
View splunkbase_skipper.js
// ==UserScript==
// @name Splunkbase download dialog skipper
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Skip the obnoxious "agree" dialog when downloading from Splunkbase
// @author Nate Plamondon
// @match https://splunkbase.splunk.com/app/*
// @grant GM_setValue
// @run-at document-body
// ==/UserScript==
@meznak
meznak / geoblock.sh
Last active May 18, 2017
Block entire countries' IP blocks automagically using ipsets.
View geoblock.sh
#!/bin/bash
#####
# Block entire countries' IP blocks automagically using ipsets.
#
# CC BY NC SA 2017 Nate Plamondon
# Inspired by https://www.nyx.chiodo.ch/?p=91 which see for firewall setup.
#####
# number of times to retry each download
@meznak
meznak / auth_qr_codes.bash
Last active May 7, 2022
Quickly generate QR codes for Google Authenticator
View auth_qr_codes.bash
#!/bin/env bash
###
# Quickly generate QR codes to easily repopulate Google Authenticator.
# To use this, you'll have to have recorded your auth secret when you activated
# multi-factor authentication. When run, this script will draw QR codes into
# your terminal, which you can then scan with Google Authenticator.
#
# NB: These secrets should be treated with the same care as your password. I recommend
# you keep this file encrypted when not in use.
View eye_processes_stderr.log
/home/diaspora/.rvm/gems/ruby-2.1.5@diaspora/gems/unicorn-4.9.0/lib/unicorn/configurator.rb:91:in `block in reload': directory for pid=/run/diaspora/diaspora.pid not writable (ArgumentError)
from /home/diaspora/.rvm/gems/ruby-2.1.5@diaspora/gems/unicorn-4.9.0/lib/unicorn/configurator.rb:87:in `each'
from /home/diaspora/.rvm/gems/ruby-2.1.5@diaspora/gems/unicorn-4.9.0/lib/unicorn/configurator.rb:87:in `reload'
from /home/diaspora/.rvm/gems/ruby-2.1.5@diaspora/gems/unicorn-4.9.0/lib/unicorn/configurator.rb:68:in `initialize'
from /home/diaspora/.rvm/gems/ruby-2.1.5@diaspora/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:100:in `new'
from /home/diaspora/.rvm/gems/ruby-2.1.5@diaspora/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:100:in `initialize'
from /home/diaspora/.rvm/gems/ruby-2.1.5@diaspora/gems/unicorn-4.9.0/bin/unicorn:126:in `new'
from /home/diaspora/.rvm/gems/ruby-2.1.5@diaspora/gems/unicorn-4.9.0/bin/unicorn:126:in `<top (required)>'
from
View sidekiq.log
2015-11-27T20:49:36.041Z 20432 TID-2qs6s INFO: [Sidetiq] Sidetiq v0.6.3 - Copyright (c) 2012-2013, Tobias Svensson <tob@tobiassvensson.co.uk>
2015-11-27T20:49:36.042Z 20432 TID-2qs6s INFO: [Sidetiq] Sidetiq is covered by the 3-clause BSD license.
2015-11-27T20:49:36.042Z 20432 TID-2qs6s INFO: [Sidetiq] See LICENSE and http://opensource.org/licenses/BSD-3-Clause for licensing details.
2015-11-27T20:49:36.042Z 20432 TID-2qs6s INFO: [Sidetiq] Sidetiq::Supervisor start
2015-11-27T20:49:36.050Z 20432 TID-kxs6s INFO: [Sidetiq] Sidetiq::Actor::Clock id: 35170800 initialize
2015-11-27T20:49:36.051Z 20432 TID-kxs6s DEBUG: [Sidetiq] Sidetiq::Clock looping ...
2015-11-27T20:49:36.059Z 20432 TID-kwq0c INFO: [Sidetiq] Sidetiq::Actor::Handler id: 35137760 initialize
2015-11-27T20:49:36.060Z 20432 TID-kwkus INFO: [Sidetiq] Sidetiq::Actor::Handler id: 35114720 initialize
2015-11-27T20:49:36.153Z 20432 TID-kxs6s DEBUG: [Sidetiq] Can't link Sidetiq::Actor::Clock. Sidekiq::Manager not running. Retrying in 5 seconds ...
2015-11-
@meznak
meznak / xscreensaver.service
Created May 27, 2015
xscreensaver lock before suspend
View xscreensaver.service
[Unit]
Description=Lock X session using xscreensaver
Before=sleep.target
[Service]
Type=oneshot
ExecStart=/usr/bin/xscreensaver-command -lock
[Install]
WantedBy=sleep.target