Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
@StevenACoffman
StevenACoffman / safecurl.sh
Last active February 14, 2017 19:51
Safe Alternative to curl | jq that will not bomb out if json is not returned
#!/bin/bash
# call this with normal curl arguments, especially url argument, e.g.
# safecurl.sh "http://example.com:8080/something/"
# separating the (verbose) curl options into an array for readability
curl_args=(
-H 'Accept:application/json'
-H 'Content-Type:application/json'
--write '\n%{http_code}\n'
--fail
--silent
@StevenACoffman
StevenACoffman / wti
Created February 15, 2017 15:14 — forked from RomiC/wti
Sample of using JIRA Rest API via bash, curl and sed.
#!/bin/bash
usage() {
echo "
Usage: wti [-h?] [-l LOGIN] ISSUE...
wti = \"(W)hat (T)he (I)ssue?\". Script tries to get description of the specified
ISSUE(es) from jira. For each ISSUE in list script will ouput the line in
the following format: ISSUE_ID — ISSUE_DESC
@StevenACoffman
StevenACoffman / jira.sh
Created February 15, 2017 17:47
JIRA curl to retrieve issue information
#!/bin/bash
JIRA_URL="https://jira.mydomain.org"
JIRA_AUTH_URI="/rest/auth/2/session"
JIRA_API_URI="/rest/api/2/"
curl -D - -u $JIRA_LOGIN:$JIRA_PASSWORD -X GET -H "Content-Type: application/json" -s ${JIRA_URL}${JIRA_API_URI/issue/$1
#!/bin/bash
#This script requires an up-to-date version of the aws cli tool
profile=$1
environment=$2
region=us-east-1
service_name=com.amazonaws.$region.s3
get_env_vpc_id () {
@StevenACoffman
StevenACoffman / Why Client Side Rendering Won.md
Last active February 27, 2017 20:41
Why Client Side Rendering Won

From Why Client Side Rendering Won:

  • No Full Page Reload Required
  • Lazy Loading
  • Rich Interactions
  • Cheap Hosting
  • Use a CDN
  • Easy Deployments
  • Enforced Separation of Concerns
  • Learn Once, Write Everywhere
  • Same UI Technology for Web, Native Mobile, and Desktop
@StevenACoffman
StevenACoffman / Erik Meier Four Fundamental Effects.md
Last active March 2, 2017 00:20
Erik Meier Four Fundamental Effects

Erik Meier -- The Four Fundamental Effects

One Many
Sync T Enumerable[T]
Async Future[T] Observable[T]
  • future = promise
  • observable = rxjs/baconjs/cyclejs/kefirjs observable

Two methods:

how-do-i-install-from-a-local-cache-with-pip

First Method

PIP_DOWNLOAD_CACHE has some serious problems. Most importantly, it encodes the hostname of the download into the cache, so using mirrors becomes impossible.

The better way to manage a cache of pip downloads is to separate the "download the package" step from the "install the package" step. The downloaded files are commonly referred to as "sdist files" (source distributions) and I'm going to store them in a directory $SDIST_CACHE.

The two steps end up being:

@StevenACoffman
StevenACoffman / req-mapping.json
Created March 4, 2017 18:12 — forked from pmuellr/req-mapping.json
aws api gateway integration request mapping template for aws lambda
{
"method": "$context.httpMethod",
"resourcePath": "$context.resourcePath",
"querystring": {
#foreach($key in $input.params().querystring.keySet())
"$key": "$input.params().querystring.get($key)"#if($foreach.hasNext),#end
#end
},
"path": {
#foreach($key in $input.params().path.keySet())
@StevenACoffman
StevenACoffman / 02_demo_test_publish.sh
Created March 5, 2017 01:51 — forked from patrickbrandt/ 02_demo_test_publish.sh
Jenkins routines for AWS Lambda + API Gateway
# This is a "Managed Script" in Jenkins
COMMIT=`aws lambda get-alias --region $AWS_REGION --function-name $FUNCTION_NAME --name $PUBLISH_FROM_ALIAS | grep "Description" | cut -d'"' -f4`
VERSION=`aws lambda publish-version --region $AWS_REGION --function-name $FUNCTION_NAME --description $COMMIT | grep "Version" | cut -d'"' -f4`
aws lambda update-alias --region $AWS_REGION --function-name $FUNCTION_NAME --function-version $VERSION --name $PUBLISH_TO_ALIAS --description $COMMIT
@StevenACoffman
StevenACoffman / AWS IOT PubSub with Websockets.md
Last active March 6, 2017 18:03 — forked from stesie/index.html
AWS IoT-based serverless JS-Webapp Pub/Sub demo

AWS IoT Workflow

From Some more on AWS IoT. It’s a little difficult to simplify what’s going on, but I think this is pretty good. At the highest level, think of it this way: AWS IoT recieves messages and routes them based on rules to other AWS services

Here’s the basic workflow of AWS IoT. It’s a simplification and leaves out a number of important services, but this is the core of it. Understanding this is to understand what AWS IOT can do … and what it can do for you.

Here’s the workflow:

  • your Things send messages
  • the Device Gateway receives and authenticates the messages
  • the Rules Engine authorizes the messages and then routes them to other AWS services