Skip to content

Instantly share code, notes, and snippets.

@frosforever
frosforever / ReleaseChecker.md
Last active August 29, 2015 14:12
Idea to check if commit is included in a release

Issues might be resolved and refrence a commit that has been merged, but without checking out the repo and then running git tag --contains <sha> theres no easy to tell if the commit is in a release.

@frosforever
frosforever / MSSQL_ObjectEncryptionCracker.sql
Created February 17, 2015 02:09
Stored Proc to decrypt MS SQL stored procs
/*
Used to decrypt MS SQL stored procs and functions.
Stolen from http://sqlity.net/en/1617/decrypting-encrypted-database-objects/
Must be run as DAC (admin in front of server name eg. ADMIN:localhost)
*/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
scalacOptions ++= Seq(
// "-Xprint:typer", // Turn this on if WartRemover acts up, to see full syntax tree
"-deprecation",
"-encoding", "UTF-8", // yes, this is 2 args
"-feature",
"-unchecked",
"-Xfatal-warnings", // Treat Warnings as Errors
"-Xlint",
"-Yno-adapted-args",
"-Ywarn-dead-code", // N.B. doesn't work well with the ??? hole
@frosforever
frosforever / Cleanly.scala
Created April 1, 2015 16:09
Open, use, and clean up resource safely
def cleanly[T, V](create: => T)(cleanup: T => Unit)(f: T => V): Try[V] =
Try {
val t = create
try {
f(t)
} finally {
cleanup(t)
}
}
@frosforever
frosforever / gitGrep.sh
Created April 3, 2015 16:16
git grep on directory with multiple repose
for i in *; do ( cd $i; git grep foo HEAD ); done
@frosforever
frosforever / GitPath.txt
Created April 20, 2015 15:09
Git Patching
Ref: https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/
git format-patch master --stdout > whatever.patch
git apply --check whatever.patch
git am --signoff < whatever.patch
@frosforever
frosforever / gist:8a7dbd7a8c952d8a46b9
Created May 4, 2015 20:19
SBT scalaTest testOnly regex
testOnly *MySuite -- -z foo
to run only the tests whose name includes the substring "foo". For exact match rather than substring, use -t instead of -z.
@frosforever
frosforever / gist:db39283d8beecfb101cd84ca35fef2ca
Created February 6, 2017 15:05
docker for mac access host (not docker xhve host) from docker container
Alias for loopback that container can see:
`sudo ifconfig lo0 alias 10.0.2.2`
container can now access stuff running on host at `10.0.2.2`!
@frosforever
frosforever / prefix_size.sh
Created October 18, 2017 13:11
recursive size of contents in bucket prefix
aws s3api list-objects --bucket BUCKET_NAME --prefix "whateverprefix/" --output json --query "[sum(Contents[].Size), length(Contents[])]"
@frosforever
frosforever / manifest.sh
Created October 18, 2017 13:14
create Redshift manifest from prefix ignoring `SUCCESS` files
aws s3api list-objects --bucket BUCKET_NAME --prefix WTVR/PREFIX/ --query 'Contents[?!contains(Key,`SUCCESS`)].{Key:Key}' --output json | jq '[.[] | .["url"] = "s3://BUCKET_NAME/" + .Key | .["mandatory"] = true | del(.Key)] | { entries: .}'