Skip to content

Instantly share code, notes, and snippets.

View mccurdyc's full-sized avatar
📷
Having Fun.

Colton J. McCurdy mccurdyc

📷
Having Fun.
View GitHub Profile
### Keybase proof
I hereby claim:
* I am mccurdyc on github.
* I am mccurdyc (https://keybase.io/mccurdyc) on keybase.
* I have a public key whose fingerprint is 4637 521F B8C6 B9CC 3D20 7FBB 9CD9 D30E BB7B 1EEC
To claim this, I am signing this object:
@mccurdyc
mccurdyc / git-clean-repo
Last active January 3, 2020 20:57
Git clean repo
# https://rtyley.github.io/bfg-repo-cleaner/
# https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery#Removing-Objects
java -jar ~/Desktop/bfg-1.13.0.jar --strip-blobs-bigger-than 5M .
rm -Rf .git/refs/original
rm -Rf .git/logs/
git count-objects -v
git tag | grep -v ignorethis | xargs git push --delete origin
git tag | grep -v ignorethis | xargs git tag -d
git push --tags --force
git count-objects -v
@mccurdyc
mccurdyc / main
Created October 18, 2019 18:31
find replace filesystem
# global grep and replace
grep -rl 'old' ./ | xargs sed -i '' 's/old/new/'
# global filename grep and replace
rename 's/old/new/g' $(find . -name "*old*")
@mccurdyc
mccurdyc / init.vim
Created August 30, 2019 14:05
Golang NeoVim Autocomplete Config
call plug#begin('~/.vim/plugged')
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-gocode.vim'
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete-lsp.vim
call plug#end()
@mccurdyc
mccurdyc / crypto-newcomers-recommended-resources.md
Last active August 20, 2019 10:47
Recommended Reading from the Gopher's Slack #crypto Channel for Cryptography Newcomers
@mccurdyc
mccurdyc / s3.go
Last active June 13, 2019 20:40
S3 Mock Upload
package output
import (
"bytes"
"github.com/aws/aws-sdk-go/service/s3/s3iface"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
type S3Writer struct {
@mccurdyc
mccurdyc / find-table-owner.sql
Created May 24, 2019 20:58
Find the Owner of a Table Postgres
select datname,dbid,objid,refclassid,refobjid,deptype,rolname, nspname || '.' || relname as objname, relowner, nspname || '.' || proname as funcname, proowner
from pg_shdepend
left join pg_roles on (pg_shdepend.refobjid = pg_roles.oid)
left join pg_database on (pg_shdepend.dbid = pg_database.oid)
left join pg_class on (pg_class.oid = pg_shdepend.objid)
left join pg_proc on (pg_proc.oid = pg_shdepend.objid)
left join pg_namespace on (pg_namespace.oid in (pg_class.relnamespace, pg_proc.pronamespace))
@mccurdyc
mccurdyc / flake-finder.sh
Created November 6, 2018 01:10
A flaky test finder for go-git
#!/usr/bin/env bash
for i in {1..5000}
do
echo $i
go test -v &>> out.txt
if grep -q 'FAIL' out.txt
then
break
default: build
current_tag:
@echo $(shell git describe --abbrev=0 --tags `git rev-list --tags --max-count=1`)
build:
dep ensure -v
GOOS=linux GOARCH=amd64 go build -o bin/project .
build_container: build
@mccurdyc
mccurdyc / zshrc
Created September 24, 2018 12:20
Open New Terminal Window to Last Working Directory
# original author: https://www.reddit.com/r/i3wm/comments/6ugxvk/set_working_directory_for_terminal/dlsntaw
# Open new terminal in same directory as last terminal:
function cd {
builtin cd $@
pwd > ~/.last_dir
}
# clobber "file exists" warning
# clobber is toggled off below
setopt clobber