Skip to content

Instantly share code, notes, and snippets.

View mklaber's full-sized avatar

Matt Klaber mklaber

View GitHub Profile
@mklaber
mklaber / run-sample.sql
Last active August 29, 2015 14:16
AWS EMR version of Esri's point-in-polygon-aggregation-hive sample
-- This is a AWS-ified version of https://github.com/Esri/gis-tools-for-hadoop/blob/master/samples/point-in-polygon-aggregation-hive/run-sample.sql
-- expects https://github.com/Esri/gis-tools-for-hadoop/tree/master/samples/lib and https://github.com/Esri/gis-tools-for-hadoop/tree/master/samples/data to be in the root of ${INPUT}
-- s3://elasticmapreduce/libs/hive/hive-script --run-hive-script --hive-versions 0.13.1 --args -f s3://my-s3-bucket/run-sample.sql -d INPUT=s3://my-s3-bucket/path/to/samples -d OUTPUT=s3://my-s3-bucket/output/
add jar
${INPUT}/lib/esri-geometry-api.jar
@mklaber
mklaber / about.md
Created April 6, 2015 18:58
ES Sense Error Formatter User Script

This user script (aka greasemonkey script) adds a "Print Error" button to the upper right corner of Marvel Sense. (It's a ! with a circle around it.)

When clicked, it looks in the output pane and checks if the body of the output looks like an ES error. If it does, it'll display it in a slightly more readable form (adds pretty line breaks, etc.).

Subsequent clicks of the Print Error button will update the error message if the content in the output has changed or hide the error message if the content in the output doesn't look like an error.

Use Greasemonkey in Firefox or Tamplermonkey in Chrome to install it.

@mklaber
mklaber / response.json
Created April 17, 2015 15:02
Stackoverflow Search Result
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 4,
"successful": 4,
"failed": 0
},
"hits": {
"total": 1,
@mklaber
mklaber / README.md
Created June 2, 2015 17:25
ScriptCreateDropIndexes_SP with spatial indexes
#!/usr/bin/env bash
# Install command-line tools using Homebrew.
# Ask for the administrator password upfront.
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

Developer Cheat Sheets

This are my cheat sheets that I have compiled over the years. Tired of searching Google for the same things, I started adding the information here. As time went on, this list has grown. I use this almost everyday and this Gist is the first bookmark on my list for quick and easy access.

I recommend that you compile your own list of cheat sheets as typing out the commands has been super helpful in allowing me to retain the information longer.

@mklaber
mklaber / HOWTO.md
Created September 23, 2015 22:14
Docker Console

Run Civis Console Docker on a Mac

  1. Install Docker Toolbox
  2. Run Docker Quickstart Terminal (you can also use Kitematic to launch the CLI)
  3. cd to your git repository's root directory
  4. Run:
docker run -i -t --rm -e "CIVIS_API_KEY=b5b55...031" -e "DATABASE_USER=youruser" -e "DATABASE_PASSWORD=somePassword" \
-v $(pwd):/app -v /some/local/tmp/directory:/data -w /app --name some-name-that-is-useful \
@mklaber
mklaber / config.yaml
Created December 11, 2015 16:56
legalmd-gist
levels:
- form: '###$x.'
num: A
- form: '####$x.'
num: 1
- form: '#####($x)'
num: a
@mklaber
mklaber / !README.md
Last active December 19, 2018 01:33
GitHub Pull Request against the current branch

README

GitHub helpfully prompts you to create a pull request after pushing a new branch. Unhelpfully, it always suggests PRing against master (or develop or whatever your main branch is). This Tampermonkey/ Greasemonkey script adds a "Compare & pull request (current branch)" button that will bring you to the PR creation page already comparing against the branch you're currently on.

image

How To:

  1. Install the Tampermonkey extension for Chrome or Greasemonkey extension for Firefox
@mklaber
mklaber / !README.md
Last active September 13, 2022 16:39
Kong Multiple IDPs on a single OpenID plugin

Multiple IdPs on a single OpenID Plugin

We can support all three major IdPs in a single OIDC plugin (configured at the workspace, service, or route scope):

  1. Keycloak
  2. WF Auth/SSO Auth
  3. Monolith Auth

This is done by following this article: [Does the openid-connect plugin support token validation for multiple IdPs][konghq].