Skip to content

Instantly share code, notes, and snippets.

View elerch's full-sized avatar

Emil Lerch elerch

View GitHub Profile
@elerch
elerch / Other
Last active August 29, 2015 14:06
/**
* State-based routing for AngularJS
* @version v0.2.10
* @link http://angular-ui.github.com/
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
typeof module!="undefined"&&typeof exports!="undefined"&&module.exports===exports&&(module.exports="ui.router"),function(n,t,i){"use strict";function l(n,t){return e(new(e(function(){},{prototype:n})),t)}function p(n){return f(arguments,function(t){t!==n&&f(t,function(t,i){n.hasOwnProperty(i)||(n[i]=t)})}),n}function ht(n,t){var r=[];for(var i in n.path){if(n.path[i]!==t.path[i])break;r.push(n.path[i])}return r}function ct(n,t){if(Array.prototype.indexOf)return n.indexOf(t,Number(arguments[2])||0);var r=n.length>>>0,i=Number(arguments[2])||0;for(i=i<0?Math.ceil(i):Math.floor(i),i<0&&(i+=r);i<r;i++)if(i in n&&n[i]===t)return i;return-1}function w(n,t,i,r){var o=ht(i,r),u,h={},c=[],s,f;for(s in o)if(o[s].params&&o[s].params.length){u=o[s].params;for(f in u)ct(c,u[f])>=0||(c.push(u[f]),h[u[f]]=n[u[f]])}return e({},h,t)}function b(n,t){var i={};ret
{
"version":3,
"file":"Other",
"lineCount":20,
"mappings":";;;;;;AAQI,OAAOA,MAAO,EAAI,WAAY,EAAG,OAAOC,OAAQ,EAAI,WAAY,EAAGD,MAAMC,QAAS,GAAIA,O,GACxFD,MAAMC,QAAS,CAAE,YAAW,CAG7B,QAAS,CAACC,CAAM,CAAEC,CAAO,CAAEC,CAAlB,CAA6B,CAGvC,Y,CAWAC,SAASA,CAAO,CAACC,CAAM,CAAEC,CAAT,CAAgB,CAC9B,OAAOC,CAAM,CAAC,IAAKA,CAAM,CAAC,QAAQ,CAAA,CAAG,EAAE,CAAE,CAAE,SAAS,CAAEF,CAAb,CAAhB,EAAyC,CAAEC,CAAvD,CADiB,CAIhCE,SAASA,CAAK,CAACC,CAAD,CAAM,CAQlB,OAPAC,CAAO,CAACC,SAAS,CAAE,QAAQ,CAACC,CAAD,CAAM,CAC3BA,CAAI,GAAIH,C,EACVC,CAAO,CAACE,CAAG,CAAE,QAAQ,CAACC,CAAK,CAAEC,CAAR,CAAa,CAC3BL,CAAGM,eAAe,CAACD,CAAD,C,GAAOL,CAAI,CAAAK,CAAA,CAAK,CAAED,EADT,CAA3B,CAFsB,CAA1B,CAML,CACKJ,CARW,CAkBpBO,SAASA,EAAS,CAACC,CAAK,CAAEC,CAAR,CAAgB,CAChC,IAAIC,EAAO,CAAA,CAAE,CAEb,IAAS,IAAAC,EAAE,GAAGH,CAAKE,KAAnB,CAA0B,CACxB,GAAIF,CAAKE,KAAM,CAAAC,CAAA,CAAG,GAAIF,CAAMC,KAAM,CAAAC,CAAA,EAAI,KAAK,CAC3CD,CAAIE,KAAK,CAACJ,CAAKE,KAAM,CAAAC,CAAA,CAAZ,CAFe,CAI1B,OAAOD,CAPyB,CAmClCG,SAASA,EAAW,CAACC,CAAK,CAAEV,CAAR,CAAe,CACjC,GAAIW,KAAKC,UAAUC,SACjB,OAAOH,CAAKG,QAAQ,CAA
javascript: (function ($) {
function load_script(src, callback) {
var s = document.createElement('script');
s.src = src;
s.onload = callback;
document.getElementsByTagName('head')[0].appendChild(s);
}
function invertElement() {
var colorProperties = ['color', 'background-color'];
@elerch
elerch / gist:7678872
Created November 27, 2013 16:39
Code to get a mocked HttpContext for unit testing
private HttpContext GetContext(IEnumerable<KeyValuePair<string,string>> postVariables)
{
postVariables = postVariables ?? Enumerable.Empty<KeyValuePair<string, string>>();
var context = new System.Web.HttpContext(
new System.Web.HttpRequest("", "http://tempuri.org", ""),
new HttpResponse(new StringWriter()));
var sessionContainer = new System.Web.SessionState.HttpSessionStateContainer("id", new System.Web.SessionState.SessionStateItemCollection(),
new HttpStaticObjectsCollection(), 10, true,
HttpCookieMode.AutoDetect,
System.Web.SessionState.SessionStateMode.InProc, false);
@elerch
elerch / sshconfig-stub
Created January 26, 2017 00:42
Stub for ~/.ssh/config
# Sane security defaults for SSH clients. Disables everything old and nasty.
# Explanation: http://mochtu.de/2015/01/06/securing-ssh-connections/
# Background information: https://stribika.github.io/2015/01/04/secure-secure-shell.html
# OSX Users: consider updating your openssh version, or you might see an error.
Host *
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
# delete diffie-hellman-group-exchange-sha1
Ciphers chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
@elerch
elerch / gist:74cc32ef31048778f10bb10110e59c42
Created January 27, 2017 23:44 — forked from agriffis/gist:2481292
.bashrc.virtualenvwrapper
# Dynamically load virtualenvwrapper functions to reduce shell startup
# time.
#
# Copyright 2012 Aron Griffis <aron@arongriffis.com>
# Released under the GNU GPL v3
#######################################################################
# Python virtualenvwrapper loads really slowly, so load it on demand.
if [[ $(type -t workon) != function ]]; then
virtualenv_funcs=( workon deactivate mkvirtualenv )
@elerch
elerch / AWSTruisms.md
Last active March 21, 2017 18:30
AWS Truisms

Always do

  • Avoid using root credentials
  • Turn on cloudtrail
  • Turn on config recorder

Always prefer

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKRF/xP6QW2On76if5qX+Hkj9jPDnToO2dEKQHacOOEh lobo@arch
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCoRxIS1Dr33Jhybd/ck7UCLQ1Df5msSpvw03w/ljgB+1sx/U+965+q597XRHHnzPey8NFrOdID4I1l0tfco1XG5DJG2yJ/zY+tbyK+0b0Yi4qbRFnH2kxKYcdHq29CiVk64o1VHJxxj78IO2wTUcgK4sXijm05LWqCik4LSfcOBEyOwK6f37Mew19KDq7UAojHLTEbVB6xiv2ufh9evn3PggirE1VtvQlTBnt3NdBDumxD1RzRoVgwMuU1FNvQeMwLnlMlvLX76vjPkRRrgBGEJ2k0BUm7slrAtRnBzIvIbouk55MIBzpPjCIi53L91KxwNkHNPldYG81C+BczN/R5 cardno:000604717732
@elerch
elerch / CJIS Policy diff.md
Last active July 31, 2017 20:55
CJIS policy diff procedure
  1. Download the PDF and pass new and old versions through: http://pdftotext.com/

  2. Take each text file and run the following bash file on it to strip out the pagination, which can really muck with the diff. Call it with < file strip-pages major.minor > file-stripped

#!/bin/bash

version=${1}
footer=CJISD-ITS-DOC-08140-$version
@elerch
elerch / cloudformation-template-shell.yaml
Last active October 5, 2017 16:22
Useful shell for starting off a yaml CloudFormation template
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
# Bucket:
# Type: String
# Default: emil
# Description: Bucket name holding source code for lambda functions
#Mappings:
#Conditions:
Resources:
MyResource: