Skip to content

Instantly share code, notes, and snippets.

🔐
...

Aaron Zauner azet

🔐
...
View GitHub Profile
@azet
azet / nginx.conf
Created Jan 24, 2014
nginx/nessus ssl config
View nginx.conf
server {
listen 80;
server_name nessus.gmi.oeaw.ac.at;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443;
server_name nessus.gmi.oeaw.ac.at;
client_max_body_size 100m;
@azet
azet / psql_internals_cheatsheet.sql
Last active Jun 18, 2019
PostgreSQL internals SQL collection
View psql_internals_cheatsheet.sql
# long running queries:
SELECT
pid,
now() - pg_stat_activity.query_start AS duration,
query,
state
FROM pg_stat_activity
WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes';
## active queries and killing them:
@azet
azet / numastat_dumb
Created May 23, 2019
numastat replacement - dumbed down (doesn't seem to be packaged in RHEL7)
View numastat_dumb
watch -n1 --differences=cumulative cat /sys/devices/system/node/node*/numastat
@azet
azet / slabinfo
Last active May 22, 2019
human readable SLABInfo
View slabinfo
awk '{printf "%5d MB %s\n", $3*$4/(1024*1024), $1}' < /proc/slabinfo | sort -nr | head -25
@azet
azet / sniff.rb
Last active Apr 3, 2019
boilerplate code for ruby packet sniffer
View sniff.rb
#!/usr/bin/env ruby
require 'packetfu'
# filter = argv[0] - tcpdump style.
# e.g. 'dst host bla.dom.tld and port http and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
# to cap. http traffic. or 'host W.X.Y.Z' to cap a speficic host/ip
cap = PacketFu::Capture.new(:start => true)
cap.save(:filter => ARGV[0])
@azet
azet / synchronize.sh
Last active Mar 28, 2019
get time offset from popular stratum 0-3 time servers (stratum 1 distribution is the biggest)
View synchronize.sh
#!/bin/sh
/usr/sbin/ntpdate -qvvvb -s 10 -p 8 time.nist.gov at.pool.ntp.org pool.ntp.org ts1.aco.net ts2.aco.net asynchronos.iiss.at ntpstm.netbone-digital.com time.ufe.cz time.fu-berlin.de atom.uhr.de ntp1.nl.uu.net ntp0.nl.uu.net ntp3.usv.ro utcnist2.colorado.edu timekeeper.isi.edu clock.sjc.he.net nist1.symmetricom.com t2.timegps.net clock.isc.org clepsydra.dec.com gps.layer42.net rackety.udel.edu mizbeaver.udel.edu clock.nyc.he.net otc1.psu.edu timehost.lysator.liu.se ntp0.as34288.net ntp1.as34288.net tick.usask.ca tock.usask.ca
@azet
azet / chk_pgsql
Last active Mar 25, 2019
keepalived 'track_script' for PostgreSQL 'bgw_replstatus' Plugin
View chk_pgsql
#!/usr/bin/env python
#
# keepalived 'track_script' for PostgreSQL 'bgw_replstatus' Plugin
#
# Author: Aaron Zauner <azet@azet.org>
# License: CC0 1.0 Public Domain (https://creativecommons.org/publicdomain/zero/1.0/)
#
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@azet
azet / QSickChill.sh
Last active Feb 8, 2019
QSickChill git without https (tlsv1 unsupported by GitHub, https checkout doesn't work on old QNAP Appliances) - howto provided in the comment section
View QSickChill.sh
#! /bin/sh
QPKG_NAME=QSickChill
QPKG_DIR=$(/sbin/getcfg $QPKG_NAME Install_Path -f /etc/config/qpkg.conf)
PID_FILE="$QPKG_DIR/config/sickchill.pid"
DAEMON_OPTS="SickBeard.py --datadir $QPKG_DIR/config --daemon --pidfile $PID_FILE --port 7073"
# Determin Arch
ver="none"
@azet
azet / opkg-upgrade-all-installed.sh
Created Dec 15, 2018
[OpenWRT] opkg upgrade all installed packages (alias)
View opkg-upgrade-all-installed.sh
alias 'opkg-upgrade'='for x in $(opkg list-upgradable | awk "{print $1}"); do opkg upgrade $x ; done'
You can’t perform that action at this time.