Skip to content

Instantly share code, notes, and snippets.

@ekristen
ekristen / Dockerfile
Created August 29, 2016 22:35
Example of how to make the RUN instructions more efficient (for Medium)
FROM ubuntu
RUN \
apt-get update && \
apt-get install -y wget sudo supervisor python-software-properies && \
apt-get update && \
add-apt-repository ppa:saltstack/salt && \
apt-get update
EXPOSE 4505 4506
@ekristen
ekristen / Dockerfile
Last active August 29, 2016 22:35
Example of how to *not* construct your RUN instructions (for Medium)
FROM ubuntu
RUN apt-get update
RUN apt-get install -y wget sudo supervisor
RUN apt-get install -y python-software-properties
RUN apt-get update
RUN apt-get install -y openssh-server
EXPOSE 4505 4506
FROM ubuntu
RUN apt-get update
RUN apt-get install -y wget sudo supervisor
RUN apt-get install -y python-software-properties
RUN apt-get update
RUN apt-get install -y openssh-server
EXPOSE 4505 4506
@ekristen
ekristen / generate_ec_keypair.js
Created March 29, 2016 13:50
Generate a secp521r1 EC keypair
var child_process = require('child_process')
function generateKeyPair(callback) {
var keypair = {
privKey: '',
pubKey: ''
}
var priv_openssl = child_process.spawn('openssl', ['ecparam', '-name', 'secp521r1', '-genkey', '-noout'])
@ekristen
ekristen / blackbox.patch
Last active August 29, 2015 14:15
Patch to make blackbox installable via homebrew
diff --git a/bin/blackbox_addadmin b/bin/blackbox_addadmin
index 782d815..a26472f 100755
--- a/bin/blackbox_addadmin
+++ b/bin/blackbox_addadmin
@@ -9,7 +9,7 @@
#
set -e
-blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+blackbox_home=$(brew --prefix)/Cellar/blackbox/1.20150203/include
sudo pip install pygit2==0.20.3
Downloading/unpacking pygit2==0.20.3
Downloading pygit2-0.20.3.tar.gz (146kB): 146kB downloaded
Running setup.py (path:/tmp/pip_build_root/pygit2/setup.py) egg_info for package pygit2
Installing collected packages: pygit2
Running setup.py install for pygit2
building '_pygit2' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -Iinclude -I/usr/include/python2.7 -c src/tree.c -o build/temp.linux-x86_64-2.7/src/tree.o
In file included from src/utils.h:34:0,
#!/bin/bash
#
# esdiagdump
#
# Usage: esdiagdump [-h <hostname/IP>:<port>] [-o <output filename>]
# hostname defaults to localhost
# output file defaults to current directory/esdiagdump.out.<timestamp>
#
# TODO:
# - Support for collecting marvel indices for export
@ekristen
ekristen / instanceluks.pillar
Last active August 29, 2015 14:02
Example State and Pillar Data for Automatic Encryption of EC2 Instance (Ephemeral) Storage for SaltStack
instanceluks:
password: global_password
passwords:
data0: password1
data1: password2
data2: password3
@ekristen
ekristen / check_docker_container.sh
Last active January 16, 2024 16:15
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# Depending on your docker configuration, root might be required. If your nrpe user has rights
# to talk to the docker daemon, then root is not required. This is why root privileges are not
@ekristen
ekristen / example.js
Last active December 1, 2018 08:12
Example Integration of Restify Endpoints
var restify = require('restify');
var restify_endpoints = require('restify-endpoints');
var endpoints = new restify_endpoints.EndpointManager({
endpointpath: __dirname + '/endpoints'
});
// Create the RESTful Server
var server = restify.createServer();