Skip to content

Instantly share code, notes, and snippets.


mattmc3 mattmc3

Block or report user

Report or block mattmc3

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
View list.txt
Classic Marcel
Quarter Marcel
Inverse Quarter Marcel
Inverse Marcel
Double Marcel
Inverse Double Marcel
Marcel Sandwich (not to be confused with the Dutch sandwich)
Double Marcel Sandwich
Double Irish Marcel
Double Irish with a Marcel Sandwich
mattmc3 / .zshrc
Created Jun 19, 2019
ZSH: Antigen heredoc bundle example
View .zshrc
antigen use oh-my-zsh
# themes I like: refined, wezm, juanghurtado, avit, kardan, juanghurtado, steeef
antigen theme avit
antigen bundles <<EOBUNDLES
mattmc3 / myapp.rb
Created Apr 29, 2019
Homebrew - Tap for private repo
View myapp.rb
# Homebrew formula for private github repo
# Requires $HOMEBREW_GITHUB_API_TOKEN to be set
# WARNING: This is a cheap way to do this. Don't use this method unless you
# really don't care about the security of you private GH token. And, let's
# be clear - this is for a private GH Enterprise repo, so you might not
# care...
class MyApp < Formula
desc "My fake app"
mattmc3 / sel_schema_from_all_dbs.sql
Created Apr 15, 2019
MSSQL - information_schema all dbs
View sel_schema_from_all_dbs.sql
drop table if exists #cols
select top 0 isc.*, cast(null as varchar(10)) as table_type, cast(null as bit) as is_primary
into #cols
declare @sql varchar(max)
set @sql = '
use ?
insert into #cols
select isc.*, ist.table_type, sys.fn_hadr_is_primary_replica(''?'')
View benchmark.zsh
#!/usr/bin/env zsh
for i in $(seq 1 10); do
/usr/bin/time zsh -i -c exit
mattmc3 / mssql.ahk
Created Mar 29, 2019
AHK - AutoHotKey save MSSQL script execution history
View mssql.ahk
;CTRL+SHIFT+R run a query, but will also copy the script and save it off
;^+r is QWERTY, ^+s is Colemak for ^+r
Send, ^c
FormatTime, DateString,,yyyyMMdd
FormatTime, TimeString,,hhmmss
FileCreateDir %HomeDir%\Documents\sqlhist\%DateString%
FileAppend, %Clipboard%, %HomeDir%\Documents\sqlhist\%DateString%\%TimeString%.sql
Send, {f5}
mattmc3 / colemak.ahk
Created Mar 29, 2019
AHK - Colemak remapping
View colemak.ahk
; Colemak layout for AutoHotkey (MS Windows)
#SingleInstance force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetTitleMatchMode 3 ; Exact matching to avoid confusing T/B with Tab/Backspace.
;top row
mattmc3 / save_clipboard.ahk
Created Mar 29, 2019
AHK - save clipboard to file
View save_clipboard.ahk
; Save clipboard to file
FileDelete, %HomeDir%\Documents\clipboard.txt
FileAppend, %Clipboard%, %HomeDir%\Documents\clipboard.txt
mattmc3 / regex_scrub.sql
Created Mar 26, 2019
MSSQL - replace non-printable non-ascii characters
View regex_scrub.sql
select dbo.RegexReplace(t.my_column, '[^\x20-\x7E]', '~') as scrubbed
from my_table t
mattmc3 / safelyrm.bash
Created Mar 25, 2019
Bash - safely rm from a script
View safelyrm.bash
under_home() {
# $HOME has to be set. Should always be, but make sure.
[[ -z "$HOME" ]] && return 1
# Handle tricky trailing slash inputs. ie: $HOME/// becomes $HOME
local somepath="$( echo "$1" | tr -s '/' )"
# Tailing slashes already removed, so now ensure the path lives under $HOME
[[ "$somepath" == "$HOME/"* ]] && return 0 || return 1
You can’t perform that action at this time.