Skip to content

Instantly share code, notes, and snippets.

View dlangille's full-sized avatar

Dan Langille dlangille

View GitHub Profile

Keybase proof

I hereby claim:

  • I am dlangille on github.
  • I am dvl (https://keybase.io/dvl) on keybase.
  • I have a public key whose fingerprint is 07DF AB2F ED74 A9BA 453F 9BB7 0A0B 1714 CFFB 9D3C

To claim this, I am signing this object:

Based on http://www.databasesoup.com/2014/05/new-finding-unused-indexes-query.html
reason | schemaname | tablename | indexname | index_scan_pct | scans_per_write | index_size | table_size
------------------------+------------+---------------+-----------------------+----------------+-----------------+------------+------------
Never Used Indexes | public | jobhisto | jobhisto_idx | 0.00 | 0.00 | 2024 kB | 13 MB
Never Used Indexes | public | fileset | fileset_name_idx | 0.00 | 0.00 | 16 kB | 16 kB
Never Used Indexes | public | pathhierarchy | pathhierarchy_ppathid | 0.00 | 0.00 | 8192 bytes | 0 bytes
Low Scans, High Writes | public | file | file_jpfid_idx | 0.71 | 0.00 | 9166 MB | 32 GB
Low Scans, High Writes | public | file | file_pathid_idx | 2.55 | 0.00 | 7230 MB | 3
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
@dlangille
dlangille / pkg-audit.sh
Last active March 1, 2022 12:57
Find all pkg audit issues in FreeBSD jails and hosts.
#!/bin/sh
JLS="/usr/sbin/jls"
PKG="/usr/sbin/pkg"
# list of the jail ids for all jails
JAILS=`${JLS} jid`
RESULT=""
CHECKING=$1
@dlangille
dlangille / 2015-09-10.1
Last active August 29, 2015 14:06
FreeBSD 9.3 IPv6 tunnel via TunnelBroker.net
# egrep -i 'ipv6|gif' /etc/rc.conf
cloned_interfaces="tun0 gif0"
ifconfig_gif0="tunnel 96.245.100.201 209.51.161.14 mtu 1480"
ifconfig_gif0_ipv6="inet6 2001:470:1f06:9ea::2 2001:470:1f06:9ea::1 prefixlen 128"
ifconfig_em0_ipv6="inet6 2001:470:1f07:09ea:1::1"
ipv6_defaultrouter="2001:470:1f06:9ea::1"
ipv6_gateway_enable="YES"
rtadvd_enable="YES"
@dlangille
dlangille / knew zfs-stats
Created September 18, 2014 15:06
zfs-stats (http://www.freshports.org/sysutils/zfs-stats) of knew, my main storage server
[dan@knew:~] $ zfs-stats -a
------------------------------------------------------------------------
ZFS Subsystem Report Thu Sep 18 15:05:39 2014
------------------------------------------------------------------------
System Information:
Kernel Version: 903000 (osreldate)
Hardware Platform: amd64
@dlangille
dlangille / gist:81028167b33d4835cfba
Last active August 29, 2015 14:06
zfs-stats (http://www.freshports.org/sysutils/zfs-stats) of slocum, my main developement server
[dan@slocum:/usr/local/etc/poudriere.d] $ zfs-stats -a
------------------------------------------------------------------------
ZFS Subsystem Report Thu Sep 18 15:07:05 2014
------------------------------------------------------------------------
System Information:
Kernel Version: 903000 (osreldate)
Hardware Platform: amd64
@dlangille
dlangille / gist:e7261dd65b6e8af1f2b3
Created September 18, 2014 15:26
zfs-stats (http://www.freshports.org/sysutils/zfs-stats) of zuul, my main production server
[dan@zuul:~] $ zfs-stats -a
------------------------------------------------------------------------
ZFS Subsystem Report Thu Sep 18 15:25:15 2014
------------------------------------------------------------------------
System Information:
Kernel Version: 903000 (osreldate)
Hardware Platform: amd64
@dlangille
dlangille / copy-for-rotation
Last active August 29, 2015 14:11
nagios plugins to: verify a list of files aren't too old, that no failed rsync files are lingering, and there are no zero-sized files.
#!/bin/sh
#
# copy each .dump and .sql file in $1 to $2
#
BACKUPDIR=$1
COPYDIR=$2
GLOBALS="globals"
cd ${BACKUPDIR}
$ cat ~/bin/bacula7-nightly-run-trunk.sh
#!/bin/sh
# This script can be used to launch either MySQL or PostgreSQL scripts. It runs PostgreSQL by default.
# usage: bacula-nightly-run-trunk.sh postgresql
echo $PATH
GIT="/usr/local/bin/git"
SRCDIR="${HOME}/src/Bacula7RegressionTesting-TRUNK"