Skip to content

Instantly share code, notes, and snippets.

@patrixgdd
patrixgdd / imagemagick.bash
Created April 1, 2022 01:58 — forked from bensie/imagemagick.bash
ImageMagick Static Binaries for AWS Lambda
#!/usr/bin/env bash
# Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime which can be found at:
# https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html
#
# As of May 21, 2019, this is:
# Amazon Linux AMI 2018.03.0 (ami-0756fbca465a59a30)
#
# You need to prepend PATH with the folder containing these binaries in your Lambda function
# to ensure these newer binaries are used.
@patrixgdd
patrixgdd / bash_strict_mode.md
Created March 5, 2022 02:51 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@patrixgdd
patrixgdd / Jenkinsfile
Created February 10, 2021 13:44 — forked from danielgehr/Jenkinsfile
Jenkins pipeline template with environment configuration using gitflow
// ***********************
//
// Build and deploy different environments with jenkins pipeline
//
// Merge to develop -> triggers development release
// Merge to master without tag -> triggers staging release
// Merge to master with tag -> triggers staging and production release
// Production release requires manual approval on the jenkins job
//
// Configure jenkins pipeline project to pull tags! By default, tags are not pulled!
@patrixgdd
patrixgdd / extract-and-load-pem.sh
Created January 21, 2021 15:37
Extract let's encrypt certificates from kubernetes and upload them to aws iam
#!/bin/sh
if [ $# -lt 3 ];
then
echo "usage: $0 <dns_name> <app_name> <environment>";
exit 1;
fi
DNS=$1
APP_NAME=$2
@patrixgdd
patrixgdd / approle.sh
Last active January 1, 2021 11:25 — forked from greenbrian/approle.sh
Vault CLI testing AppRole
#!/bin/bash
# start vault
VAULT_UI=true vault server -dev -dev-root-token-id=root -dev-listen-address=127.0.0.1:8200
# login as root - DO NOT DO THIS IN PRODUCTION
vault login root
# write some secrets
vault kv put secret/test color=blue number=eleventeen
@patrixgdd
patrixgdd / openvpn-useradd-bulk.sh
Created January 22, 2020 08:54 — forked from Nyr/openvpn-useradd-bulk.sh
Simple script for adding users in bulk to an openvpn-install setup
#!/bin/bash
# Fast way for adding lots of users to an openvpn-install setup
# See the main openvpn-install project here: https://github.com/Nyr/openvpn-install
# openvpn-useradd-bulk is NOT supported or maintained and could become obsolete or broken in the future
# Created to satisfy the requirements here: https://github.com/Nyr/openvpn-install/issues/435
if readlink /proc/$$/exe | grep -qs "dash"; then
echo "This script needs to be run with bash, not sh"
exit 1
@patrixgdd
patrixgdd / setup.tf
Created January 21, 2020 14:01 — forked from a-h/setup.tf
Terraform - Creating an Instance with an S3 Bucket Policy
# Create an IAM role for the Web Servers.
resource "aws_iam_role" "web_iam_role" {
name = "web_iam_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {