Skip to content

Instantly share code, notes, and snippets.

@030
030 / script-template.sh
Created Apr 13, 2021 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
View script-template.sh
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@030
030 / pfx-to-crt-and-key.sh
Created Nov 6, 2020 — forked from whereisaaron/pfx-to-crt-and-key.sh
Extract a crt file (PEM), key file, and chain bundle from a PFX file, prompts for password or use PFXPASSWORD environment variable
View pfx-to-crt-and-key.sh
#!/bin/bash
#------------------
# Extract the key, certficiate, and chain in PEM format from a PFX format file
#
# Must supply the input pfx file
PFX_PATH="$1"
if [ "${PFX_PATH}" == "" ]; then
echo "Must supply pfx file path"
exit 1
View nexus-docker.sh
#!/bin/bash -e
NEXUS_VERSION="${1:-3.21.1}"
NEXUS_API_VERSION="${2:-v1}"
validate(){
if [ -z "${NEXUS_VERSION}" ] || [ -z "${NEXUS_API_VERSION}" ]; then
echo "NEXUS_VERSION and NEXUS_API_VERSION should be specified."
exit 1
fi
@030
030 / lambda-vpc-internet-access-cloudformation.yml
Created Jun 25, 2019 — forked from romaninsh/lambda-vpc-internet-access-cloudformation.yml
CloudFormation template implementing Private network which can be used by Serverless to deploy Lambda into VPCs an maintaining internet access
View lambda-vpc-internet-access-cloudformation.yml
# Add the following to your existing VPC CF stack
# create 2 subnets, lambdas like to be in multiple subnets
Private1:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
AvailabilityZone: !Select [ 0, !GetAZs ]
CidrBlock: !Ref Private1CIDR
View how-to-setup-lambda-to-talk-to-internet-and-vpc.md

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
View increment_tag.sh
#!/bin/bash -e
#based on: https://stackoverflow.com/a/27332476/2777965
#get highest tag number
VERSION=`git describe --abbrev=0 --tags`
#replace . with space so can split into an array
VERSION_BITS=(${VERSION//./ })
View readme-badges-generator.sh
#!/bin/bash
set -e
USERNAME=$1
PROJECTNAME=$2
CII_PROJECT_ID=$3
if [[ -z "${PROJECTNAME}" || -z "${USERNAME}" || -z "${CII_PROJECT_ID}" ]]; then
echo "ProjectName, CII project ID and/or Username should not be empty"
@030
030 / Makefile
Created May 17, 2019 — forked from h4cc/Makefile
Ubuntu 18.04 Bionic Beaver - Basic packages i usually install
View Makefile
#
# Ubuntu 18.04 (Bionic Beaver)
#
# Basic packages i usually install.
#
# Author: Julius Beckmann <github@h4cc.de>
#
# Upgraded Script from 17.04: https://gist.github.com/h4cc/09b7fe843bb737c8039ac62d831f244e
# Upgraded Script from 16.04: https://gist.github.com/h4cc/fe48ed9d85bfff3008704919062f5c9b
View go-releases.sh
#!/usr/bin/env bash
set -e
readonly ARTIFACT_NAME=$1
formatting() {
echo "Go formatting..."
diff -u <(echo -n) <(gofmt -d ./)
}