Skip to content

Instantly share code, notes, and snippets.

View jthomerson's full-sized avatar

Jeremy Thomerson jthomerson

View GitHub Profile
I am attesting that this GitHub handle jthomerson is linked to the Tezos account tz1RKNRb6wAW6mTWwLmzSVNuPhrXNVcRVQzF for tzprofiles
sig:edsigtkTPx3sTnisB16dfYfJGteGRQgrAx9MVgTWsi4XFaPeGgSrAiSfvPc2bVi63nQGySf7JVM51Hf45ADGc1DFkeXU2QweS3g
<?php
phpinfo()
START=2018-10-01T00:00:00Z
END=2018-11-01T00:00:00Z
function GetStats() {
SUMUNITS=$(aws cloudwatch get-metric-statistics --start-time ${START} --end-time ${END} --metric-name $1 --namespace AWS/DynamoDB --statistics Sum --dimensions Name=TableName,Value=$2 --period 3600 | jq .Datapoints[].Sum | awk 'BEGIN {SUM=0}; {SUM=SUM+$1}; END {printf "%.3f\n", SUM}')
}
for TABLENAME in $(aws dynamodb list-tables | jq -r .TableNames[]); do
GetStats "ConsumedReadCapacityUnits" "${TABLENAME}"
echo "${TABLENAME} Read ${SUMUNITS}"

Keybase proof

I hereby claim:

  • I am jthomerson on github.
  • I am jthomerson (https://keybase.io/jthomerson) on keybase.
  • I have a public key ASD4-E_FMttq8liAYR94-9mymhKtHpGO9_tvBG3AqvMq7go

To claim this, I am signing this object:

@jthomerson
jthomerson / delete-all-cloudsearch-documents.sh
Created April 24, 2017 14:50
Delete all CloudSearch documents in a given domain
#!/bin/bash
# This script will delete *all* documents in a CloudSearch domain.
# USE WITH EXTREME CAUTION
# Note: depends on the AWS CLI SDK being installed, as well as jq
# For jq, see: https://stedolan.github.io/jq/ and https://jqplay.org/
if [[ ! $# -eq 2 || $1 != "--doc-domain" || ! $2 =~ ^https://.*$ ]]; then
echo "Must define --doc-domain argument (e.g. --doc-domain https://somedomain.aws.com)";
@jthomerson
jthomerson / serverless.yml
Created September 8, 2016 15:40
weird error with serverless.yml variables
service: testapi
vars:
defaultRegion: us-east-1
region: ${opt:region, self:vars.defaultRegion}
stage: ${opt:stage, env:USER}
provider:
name: aws
runtime: nodejs4.3
@jthomerson
jthomerson / gist:6595716
Created September 17, 2013 15:13
written in vim quickly - ignore compile errors
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
index 968a93c..3272cc1 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
@@ -333,7 +333,7 @@ public class FeedbackPanel extends Panel implements IFeedback
protected Component newMessageDisplayComponent(String id, FeedbackMessage message)
{
Serializable serializable = message.getMessage();
- Label label = new Label(id, (serializable == null) ? "" : serializable.toString());
+ Label label = new Label(id, (serializable instanceof IModel<?> ? ((IModel<?>) serializable) : (serializable == null) ? "" : serializable.toString()));
@jthomerson
jthomerson / SS3 $indexes format changes
Created August 12, 2013 18:25
Changes that had to be made to the $indexes array for SilverStripe 3.
- 'Locale' => '(Locale)',
- 'VernacularAbbreviation' => array('type' => 'unique', 'value' => 'VernacularAbbreviation'),
- 'VernacularAbbreviation_Locale' => '(VernacularAbbreviation, Locale)',
+ 'Locale' => '("Locale")',
+ 'VernacularAbbreviation' => array('type' => 'unique', 'value' => '"VernacularAbbreviation"'),
+ 'VernacularAbbreviation_Locale' => '("VernacularAbbreviation","Locale")',
@jthomerson
jthomerson / name of file
Created July 29, 2011 00:08
test 1, 2, 3 description
this is content