Skip to content

Instantly share code, notes, and snippets.

@aidmax
aidmax / gist:5d62c7319c2cace2f82f33423a274dc7
Last active September 13, 2022 19:01
Detect AWS region and account_id and save it to .bashrc
# Configure AWS CLI with the current region as default
echo "export AWS_DEFAULT_REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region)" >> ~/.bashrc
echo "export AWS_REGION=\$AWS_DEFAULT_REGION" >> ~/.bashrc
echo "export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)" >> ~/.bashrc
source ~/.bashrc
# Verify that AWS_REGION is set correctly
test -n "$AWS_REGION" && echo AWS_REGION is "$AWS_REGION" || echo AWS_REGION is not set
socat is one love 🖤
Need a TCP reverse proxy? This one-liner starts a TCP server on IP1:PORT1 that forwards all incoming conns to IP2:PORT2:
```
socat tcp-listen:8080,bind=0.0.0.0,reuseaddr,fork tcp:localhost:80
```
Super handy when you need to expose a private server quickly
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
kubeadmConfigPatches:
- |
kind: ClusterConfiguration
networking:
dnsDomain: "dev.local"

Keybase proof

I hereby claim:

  • I am aidmax on github.
  • I am aidmax (https://keybase.io/aidmax) on keybase.
  • I have a public key ASCZG53ke4W_8hxwrpmXwaO7bXLtt0vJAgmCHeMOtXCjkAo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am aidmax on github.
* I am aidmax (https://keybase.io/aidmax) on keybase.
* I have a public key ASCZG53ke4W_8hxwrpmXwaO7bXLtt0vJAgmCHeMOtXCjkAo
To claim this, I am signing this object:
@aidmax
aidmax / ansible_wrapper.sh
Created November 9, 2020 07:05
Adds log output to file for ansible
#!/bin/sh
d=$(date '+%Y.%m.%d_%H%M')
export ANSIBLE_LOG_PATH=./ansible-run-$d.log
$@
@aidmax
aidmax / gist:299cc1364b767e92a582fcdaa4857dcb
Last active November 11, 2020 06:17
mvn command docker alias
$ alias mvn='docker run -it -v $(pwd):$(pwd) -w $(pwd) maven:3.6-jdk-8-alpine mvn'
$ mvn clean package
terraform plan -no-color | grep -E '(^.*[#~+-] .*|^[[:punct:]]|Plan)'
https://github.com/hashicorp/terraform/issues/10507
@aidmax
aidmax / tmbackup.sh
Last active March 13, 2020 10:50
Install Time Machine service on CentOS 7
# Install Time Machine service on CentOS 7
# Updated for netatalk 3.1.12
# install required packages for compiling from source
yum install -y rpm-build gcc make wget
# install Perl-IO-socket dependency for netatalk 3.1.12
yum install -y perl-IO-Socket-INET6 perl-interpreter perl-generators libxslt
# install netatalk
@aidmax
aidmax / simplifiedGitFlow.md
Created May 15, 2019 06:32 — forked from vxhviet/simplifiedGitFlow.md
A simplified version of Git Flow

Simplified Git-flow

                        RELEASE TAG
o----------------------------o-----------------o------------o------> MASTER
 \                          /  \                \----------/ HOTFIX
  \                        /    \                          \
   \----------------------/      \--------------------o-----o------> DEVELOP
                                  \                  /
 \----------------/ FEATURE