Skip to content

Instantly share code, notes, and snippets.

View lincolnthomas's full-sized avatar

Lincoln Thomas lincolnthomas

View GitHub Profile
@lincolnthomas
lincolnthomas / empty-a-set-of-dynamo-tables.txt
Created September 1, 2020 18:38
Empty a set of DynamoDB tables
It's a PITA to delete all items in an AWS DynamoDB table without deleting the table.
True, you can delete and re-create the table, but resource ARNs will change (like DyanmoDB Streams), which
can disrupt other resources depending on those ARNs.
I found https://www.npmjs.com/package/dynamodb-empty which does (most of) the job.
Note:
1. The README there is wrong, as of this writing. The correct syntax is:
$ dynamodb-empty --table {tablename}
@lincolnthomas
lincolnthomas / rotate-debug.sh
Created January 25, 2017 20:18
Force rotate of /var/log/eucalyptus/cloud-debug.log* files. The eucalyptus-cloud service must NOT be running. Gives you a fresh cloud-debug.log file when you restart the service, for easier debugging.
#!/bin/bash
VLED=/var/log/eucalyptus/cloud-debug.log
rm -f $VLED.10
for ((i=9; i>0; i--)) ; do
j=$((i+1))
mv $VLED.$i $VLED.$j
done
mv $VLED $VLED.1
@lincolnthomas
lincolnthomas / createDeleteSnaps.txt
Created January 22, 2017 01:53
Scripts to create / delete lots of snapshots
Create a lot of snaps, serially or in parallel:
snaps-create.sh
======================
#!/bin/bash
set -x
VOLUME=$1
NUMSNAPS=$2
PARALLEL=$3
echo Creating $NUMSNAPS snapshots on volume $VOLUME
if [ -n "$PARALLEL" ]; then
@lincolnthomas
lincolnthomas / SystemUtilDebugSnippet.java
Created January 17, 2017 19:58
Show return code, stdout, and stderr from shell commands
// Add the "LPT" section to this method (or similarly for other the other run...() methods in this class).
// Existing code as of 17-Jan-2017 from eucalyptus/clc/modules/core/src/main/java/edu/ucsb/eucalyptus/util/SystemUtil.java
//...
public static int runAndGetCode(String[] command) {
boolean hasTicket = maybeRestrictedOp( command );
try
{
String commandString = "";
for(String part : command) {
@lincolnthomas
lincolnthomas / customize.txt
Last active January 5, 2017 01:40
Customizing newly deployed systems
When I deploy a new machine N (such as a Eucalyptus test node) I want to log into from my machine M,
here's what I do to set up passwordless logins, get my personal .bashrc on the system,
and set up the prompt so I know what machine I'm talking to.
One-time setup:
---------------
On machine M:
Add your id_rsa.pub and id_rsa files to your ~/.ssh directory.
@lincolnthomas
lincolnthomas / s3_nephoria_boto_interfaces.out
Created September 28, 2016 16:06
List of user service interfaces in nephoria for s3 in boto2 and boto3
### ipython
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
Type "copyright", "credits" or "license" for more information.
IPython 2.3.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.