Skip to content

Instantly share code, notes, and snippets.

Matthew Dreyer Dreyer

Block or report user

Report or block Dreyer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am dreyer on github.
  • I am dreyer ( on keybase.
  • I have a public key whose fingerprint is 1FC2 90F9 9E14 B6D8 35D4 BC81 4758 2E67 AAD0 DFCD

To claim this, I am signing this object:

Dreyer / database_fragmentation.sql
Created Jul 3, 2017
Display database fragmentation for each table.
View database_fragmentation.sql
-- USE AdventureWorks;
SELECT AS 'sys_schema', AS 'sys_table', AS 'sys_index',
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) x
INNER JOIN sys.tables t ON t.object_id = x.object_id
Dreyer / dfwp.js
Last active Jun 18, 2017
Re-enable copy-paste for stupid sites that block it.
View dfwp.js
// Paste the snippet in Chrome console and hit enter.
// Source:
document.addEventListener('paste', (e) => { e.stopImmediatePropagation(); return true; }, true);
View outdated.js
* Outdated Disclaimer for Posts
* Adds a disclaimer to each post which exceeds the threshold.
* Set the threshold values in `_config.yml`:
* outdated:
* threshold:
* value: 12
* unit: months
Dreyer /
Last active Apr 6, 2017
Troubleshooting postfix (sendmail) support for PHP's mail() function on Ubuntu 16.04 Xenial.
# Postfix local send only
# Based on the null client setup:
# $ vi /etc/postfix/
# $ hostname -f
Dreyer / perlbrew_libgcc_s.txt
Created Jan 20, 2017
[perlbrew] ld: library not found for -lgcc_s.10.4
View perlbrew_libgcc_s.txt
$ cd /usr/local/lib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.4.dylib
Dreyer / AutoConnectVPN.applescript
Created Jan 5, 2017
Automatically reconnect when disconnected from the VPN.
View AutoConnectVPN.applescript
on idle
tell application "System Events"
tell current location of network preferences
set myConnection to the service "WorkVPN"
if myConnection is not null then
if current configuration of myConnection is not connected then
connect myConnection
end if
end if
end tell
Dreyer /
Last active Jan 5, 2017
Batch edit the properties of Matroska files.
# Iterate through every .MKV file in the current directory and use the
# filename base as the title while assigning the second subtitle track
# as the default and the second audio track as the default.
# Requires mkvpropedit from MKVToolNix:
for file in *.mkv; do base=${file%.*}; mkvpropedit "${file}" --edit info --set "title=${base}" --edit track:s1 --set flag-default=0 --edit track:s2 --set flag-default=1 --edit track:a1 --set flag-default=0 --edit track:a2 --set flag-default=1; done
Dreyer /
Last active Nov 3, 2017
Check the status of a NordVPN connection from your shell.
JSON=$(curl -s $URL)
printf "\n"
#echo $JSON | python -m json.tool
echo $JSON | python -c 'import sys, json; data = json.load(sys.stdin); print "IP: %s (%s)\nStatus: %s" % (data["ip"], data["isp"], "\033[32mProtected" if data["status"] is True else "\033[31mUnprotected");'
printf "\n"
Dreyer / release.js
Last active Dec 2, 2018
Create an Elastic Beanstalk release using Node.js + AWS CLI.
View release.js
const program = require('commander')
const moment = require('moment')
const {exec} = require('child_process')
const cwd = process.cwd()
const version = process.env.npm_package_version || '0.0.0'
// Amazon Elastic Beanstalk.
const name = 'Example App'
You can’t perform that action at this time.