Skip to content

Instantly share code, notes, and snippets.

View caffeinetiger's full-sized avatar

Tony Benavides caffeinetiger

  • Chromatic Ai Swarm
  • Earth
View GitHub Profile
@caffeinetiger
caffeinetiger / Dockerfile
Last active April 18, 2022 18:20
Example Dockefile to build a ASPNet Core 3.1 project inside a Dockerfile using AWS CodeArtifact. **Required Docker Build Arguments** - AWS_ACCOUNT_ID - Id of the AWS Account of the ECR repository to push to. - AWS_ACCESS_KEY_ID - Specifies an AWS ac
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat
FROM mcr.microsoft.com/dotnet/aspnet:3.1-alpine AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
#!/bin/bash
exit_on_error() {
exit_code=$1
last_command=${@:2}
if [ $exit_code -ne 0 ]; then
>&2 echo "\"${last_command}\" command failed with exit code ${exit_code}."
exit $exit_code
fi
}
#!/bin/bash
function exit_if_command_not_installed() {
local some_command_to_check=$1
if ! command -v $some_command_to_check &> /dev/null
then
echo "$some_command_to_check could not be found"
exit
fi
}
@caffeinetiger
caffeinetiger / Dockerfile
Last active April 18, 2022 18:11
Amazon Linux 2 base docker image with updated aws cli, kubectl, and eksctl
FROM amazonlinux:2.0.20210219.0
ARG PYTHON_VERSION=3.8.5
ARG BOTO3_VERSION=1.17.38
ARG BOTOCORE_VERSION=1.20.38
ARG APPUSER=app
RUN yum -y update &&\
yum install -y shadow-utils findutils gcc sqlite-devel zlib-devel wget tar.x86_64 gzip make unzip \
bzip2-devel openssl-devel readline-devel libffi-devel && \

Updating TLS Settings for AWS Classic Load Balancers

This is a simple how-to on updating an AWS Classic Load Balancer with a specific TLS Negotiaion Policy. Just read the script to see how the update works.

To get a list of available predefined policies that are available execute

aws elb describe-load-balancer-policies --query 'PolicyDescriptions[?PolicyTypeName==`SSLNegotiationPolicyType`].{PolicyName:PolicyName}' --output table
@caffeinetiger
caffeinetiger / install_oracle_jdk_11.sh
Last active April 18, 2022 16:58
References: - [Install Java 11 (OpenJDK 11) on RHEL 8|CentOS 8|Rocky Linux 8](https://computingforgeeks.com/how-to-install-java-11-openjdk-11-on-rhel-8/)
#!/bin/bash
curl -L -b "oraclelicense=a" -O https://download.oracle.com/otn-pub/java/jdk/11.0.14%2B8/7e5bbbfffe8b45e59d52a96aacab2f04/jdk-11.0.14_linux-x64_bin.rpm
sudo rpm -Uvh jdk-11.0.14_linux-x64_bin.rpm
java -version
# If 11 does not display use the alternatives tool to set the version of java
sudo update-alternatives --config 'java'
@caffeinetiger
caffeinetiger / bash_cheatsheet_check_env_vars.md
Last active April 18, 2022 16:58
## References: - [Checking if a Linux Environment Variable Is Set or Not](https://www.baeldung.com/linux/environment-variable-check-if-set) - [Bash Cheatsheet: check if environment variables are set or file/symlinks exists + more](https://codewithhug
#!/bin/bash
git clone git@github.com:whatever directory-name
#!/bin/bash
BITBUCKET_USERNAME=someperson
BITBUCKET_PASSWORD=somepassword
mkdir some-dir
# The follow command works by default in Amazon Linux 2 out of the box for Python 2.7.x
# App passwords need to be URL encoded to work
URL_ENCODED_PASSWORD=$(python -c "import urllib;print urllib.quote(raw_input())" <<< "${BITBUCKET_PASSWORD}")
git clone https://${BITBUCKET_USERNAME}:${URL_ENCODED_PASSWORD}@bitbucket.org/sometreamorg/somerepo.git some-dir