Skip to content

Instantly share code, notes, and snippets.

@philgebhardt
philgebhardt / etc_default_gremlind
Created March 13, 2020 22:28
Example environment file to pass to the Gremlin Agent when running systemd or sysv
#==============================#
# Gremlin Daemon Configuration #
#==============================#
# This file is used to expose configuration to the Gremlin daemon process (`gremlind`)
# NOTE: Some process managers such as sysvinit may require these variables to be preceded
# by `export`
# When the Gremlin daemon starts, it will automatically issue a `gremlin init` command to
## Gremlin Identifier; uniquely identifies this machine with Gremlin
## (can also set with GREMLIN_IDENTIFIER environment variable)
identifier: gremlin-01
## Gremlin Team Id; you can find this value at https://app.gremlin.com/settings/teams
## (can also be set with GREMLIN_TEAM_ID environment variable)
team_id: 11111111-1111-1111-1111-111111111111
## Gremlin Client Tags; Tag your machine with key-value pairs that help you target this machine during attacks
## (can also set with GREMLIN_CLIENT_TAGS environment variable)
@philgebhardt
philgebhardt / gremlin_suse_12_install.sh
Last active October 1, 2020 20:54
Install Gremlin on SUSE 12
#!/bin/bash
sudo zypper update \
&& sudo zypper addrepo https://rpm.gremlin.com/gremlin.repo \
&& sudo zypper refresh \
&& curl -fsSL https://rpm.gremlin.com/gremlin-pgp-public.key | xargs -0 printf "%s\n" > gremlin-pgp-public.key \
&& sudo rpm --import gremlin-pgp-public.key \
&& sudo zypper install libcap-progs \
&& sudo zypper install gremlin gremlind \
&& sed -e "\$aSSL_CERT_FILE=/etc/ssl/ca-bundle.pem" /etc/default/gremlind.example \
| sudo tee /etc/default/gremlind >/dev/null \
@philgebhardt
philgebhardt / post-receive
Last active October 13, 2018 22:14
Git post-receive hook built for running `make check`
#!/bin/bash
set -e
set -o pipefail
set -x
WORKTREE=
GITDIR=
test -z $WORKTREE && exit 0
@philgebhardt
philgebhardt / increment_version.gradle
Created May 29, 2018 17:13
increment a project's gradle version
task increment {
doLast {
String patch=version.substring(version.lastIndexOf('.')+1)
int m=patch.toInteger()+1
String majorMinor=version.substring(0,version.lastIndexOf('.'))
String s=buildFile.getText().replaceFirst("version='${version}'","version='${majorMinor}.${m}'")
buildFile.setText(s)
}
}
@philgebhardt
philgebhardt / BatchDynamo.java
Last active December 19, 2017 20:29
This DynamoDB client is configured for batch processing
/**
* This dynamodb configuration is for batch processing, taking up to 30 seconds to finish communicating
* with the database
*/
public final AmazonDynamoDB getDynamoDBForBatchProcessing() {
return AmazonDynamoDBClientBuilder.standard()
.withRegion(this.regions)
.withClientConfiguration(new ClientConfiguration()
.withConnectionTimeout(500)
.withClientExecutionTimeout(30000)
@philgebhardt
philgebhardt / RealTimeDynamo.java
Created December 18, 2017 22:13
This DynamoDB client is configured for real-time processing
/*
* This dynamodb configuration is for real-time processing, which avoids spending too much time trying to
* connect to dynamodb -- failing quickly with a ClientExecutionTimeout if dynamo cannot be reached within 1 second
*/
public final AmazonDynamoDB getDynamoDBForRealTimeProcessing() {
return AmazonDynamoDBClientBuilder.standard()
.withRegion(this.regions)
.withClientConfiguration(new ClientConfiguration()
.withConnectionTimeout(500)
.withClientExecutionTimeout(1000)
@philgebhardt
philgebhardt / dockerrme
Created November 28, 2016 05:44
BASH function for `docker rm` on every docker container, excluding volumes.
#!/bin/bash
# Remove every docker container, excluding volumes.
# Takes any number of arguments which SHOULD serve as arguments to `docker rm`.
function dockerrme(){
target="$(docker ps -aq | grep -v $(docker volume ls -q))"
if [ ! -z "$target" ]
then
docker rm $@ $target
fi
}
@philgebhardt
philgebhardt / DynamoDBTest.java
Created January 31, 2016 03:02
Testing DynamoDB integration locally with Local DynamoDB and TestNG
package org.foo.app;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient;
import com.amazonaws.services.dynamodbv2.document.DynamoDB;
import com.amazonaws.services.dynamodbv2.document.Table;
import com.amazonaws.services.dynamodbv2.local.main.CommandLineInput;
import com.amazonaws.services.dynamodbv2.local.main.ServerRunner;
import com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer;
import com.amazonaws.services.dynamodbv2.model.*;