Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeremy Thomerson jthomerson

View GitHub Profile
View get-dynamodb-consumed-metrics.sh
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}"
View keybase.md

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 Apr 24, 2017
Delete all CloudSearch documents in a given domain
View delete-all-cloudsearch-documents.sh
#!/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 Sep 8, 2016
weird error with serverless.yml variables
View serverless.yml
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 Sep 17, 2013
written in vim quickly - ignore compile errors
View gist:6595716
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 Aug 12, 2013
Changes that had to be made to the $indexes array for SilverStripe 3.
View SS3 $indexes format changes
- '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 Jul 29, 2011
test 1, 2, 3 description
View name of file
this is content
You can’t perform that action at this time.