Skip to content

Instantly share code, notes, and snippets.

View christopherdeutsch's full-sized avatar

Chris Deutsch christopherdeutsch

View GitHub Profile
# Package Maintainer: Increment phusion_release to match latest release available
%define phusion_release 2010.02
Summary: Ruby Enterprise Edition (Release %{phusion_release})
Name: ruby-enterprise
Vendor: Phusion.nl <[email protected]>
Packager: Adam Vollrath <[email protected]>
Version: 1.8.7
Release: 5%{dist}
License: GPL
@christopherdeutsch
christopherdeutsch / execnofd.c
Created July 25, 2012 20:43
execnofd - run a program after closing file descriptors >2
/* execnofd
*
* exec a program after closing all fd's > 2
*
* Syntax: execnofd <command> <options>
*
* Example: execnofd ls -l /home
*
*/
@christopherdeutsch
christopherdeutsch / upgrade.sh
Last active January 6, 2023 03:06
Upgrade a Cassandra node
#!/bin/bash
#
# Upgrade a node
#
cassandra_config="/etc/cassandra/cassandra.yaml"
echo "Taking snapshot..."
nodetool -h localhost snapshot
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
int main(int argc, char **argv) {
struct rlimit mylimits;
getrlimit(RLIMIT_CORE, &mylimits);
printf("running with pid %d\n", getpid());
@christopherdeutsch
christopherdeutsch / self_signed_ca.sh
Created May 17, 2018 18:21
OpenSSL Self-Signed CA
#
# quick and dirty commands to set up a new self-signed CA using OpenSSL
#
mkdir certs crl newcerts private
touch ./certs.db
touch ./certs.db.attr
echo 00 > ./certs.seq
cat > ca.cnf << EOF
[ca]
@christopherdeutsch
christopherdeutsch / Dockerfile
Last active July 28, 2020 17:44
webpack cache-at-build-time Dockerfile example
# build webpack at runtime and write the build envionment name to a file
FROM whatever
ARG WEBPACK_BUILD_ENV=dev
RUN npm run build:${WEBPACK_BUILD_ENV && echo ${WEBPACK_BUILD_ENV} > /webpack-environment.env
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["myapp"]
@christopherdeutsch
christopherdeutsch / newrelic_sendgrid_metrics.md
Last active November 20, 2020 19:10
Newrelic Sendgrid metric names

Metric names used by the NewRelic Sendgrid integration

These were found via the NewRelic API and don't seem to be documented anywhere. They seem to reset automatically at midnight, so its possible to create NR alerts for blocks if needed.

Note that the plugin on NewRelic hasn't been updated in a while as of the time of this writing; clicking the button to install it will yield a 404. However, configuring it from the Sendgrid side will cause the data to be send and start appearing in NR.

Component/Numeric/Compliance/Blocked[Emails/Day]
Component/Numeric/Compliance/Bounces[Emails/Day]
@christopherdeutsch
christopherdeutsch / vault21pass.sh
Created February 7, 2025 20:23
Grab latest AWS credential from Vault, add it to 1pass, and generate a link for the user
#!/bin/bash -ex
#
# Get an AWS secret from Vault and send a temporary 1Password link to a user
#
# See:
# * https://1password.com/downloads/command-line/
# * https://developer.hashicorp.com/vault/docs/commands
#
ONEPASS_VAULT_NAME="my1passvault"
VAULT_ADDR="https://vault.example.com"