Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
@StevenACoffman
StevenACoffman / s3_price_tag.py
Last active February 14, 2017 15:01
Recursively walk S3 and tag items based upon a mapping
#!/usr/bin/env python
import argparse
import boto3
import fnmatch
import json
import logging
import re
from collections import OrderedDict
from datetime import datetime
#!/bin/bash
# expects the lambda function .py file to be in the same directory as this script.
# based off of Amazon's official documentation:
# http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-deployment-pkg.html#with-s3-example-deployment-pkg-python
# get the lambda function
lambda_func_file=$1
lambda_func="${lambda_func_file%.*}"
# exit if no file specified
[[ -z "$1" ]] && { echo "Lambda function is empty" ; exit 1; }
# generate a deployment timestamp
@StevenACoffman
StevenACoffman / lambda.py
Created February 12, 2017 17:29 — forked from babo/lambda.py
Simple AWS lambda job to create an SQS event for each S3 events.
#!/usr/bin/env python
import argparse
import logging
try:
from urllib import splittype
except ImportError:
from urllib.parse import splittype
import boto3
@StevenACoffman
StevenACoffman / s3_price_tag_lambda.py
Last active February 14, 2017 15:07
Tag S3 Objects by mapping file
#!/usr/bin/env python
import argparse
import boto3
import fnmatch
import json
import logging
import re
from collections import OrderedDict
from datetime import datetime
@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 / send_metric_to_statsd.sh
Last active November 18, 2022 17:57 — forked from nstielau/send_metric_to_statsd.sh
Send a metric to StatsD from bash
# Send a metric to statsd from bash
#
# Useful for:
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/)
# init scripts
# sending metrics via crontab one-liners
# sprinkling in existing bash scripts.
#
# netcat options:
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed.
@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
@StevenACoffman
StevenACoffman / git_jira_github_pull_request.sh
Last active August 20, 2021 04:11
Create Github pull request from JIRA and git
#!/bin/bash
function safe_curl() {
# call this with a url argument, e.g.
# safecurl.sh "http://eureka.test.cirrostratus.org:8080/eureka/v2/apps/"
# separating the (verbose) curl options into an array for readability
hash curl 2>/dev/null || { echo >&2 "I require curl but it's not installed. Aborting."; exit 1; }
hash jq 2>/dev/null || { echo >&2 "I require jq but it's not installed. Aborting."; exit 1; }
hash sed 2>/dev/null || { echo >&2 "I require sed but it's not installed. Aborting."; exit 1; }

Also check out my other gist comparing ajax techniques

redux-saga redux-thunk redux-observable redux-loop redux-ship redux-logic redux-cycles redux-side-effects redux-query
Works in ES5 1 X X X 1 X X 1 ?
Logic in one place X X X X X X ?
Easy to test X X X X ?
Supports cancellation X X X X ?
Imperative code X X X X ?
Reactive code X X ?