Skip to content

Instantly share code, notes, and snippets.

@Auronmatrix
Auronmatrix / run.sh
Last active June 22, 2020 09:12
aws cli - Lookup Unknown IP address across all regions
# Sources:
# https://aws.amazon.com/premiumsupport/knowledge-center/vpc-find-owner-unknown-ip-addresses/
# https://github.com/aws/aws-cli/issues/1777
for region in $(aws ec2 describe-regions --all-regions --query "Regions[*].RegionName" --output text --profile=<PROFILE>)
do
echo -e "\nLookup IP in region:'$region'..."
aws ec2 describe-network-interfaces --filters Name=association.public-ip,Values=<PUBLIC_IP> --profile=<PROFILE> --region=$region
done
@Auronmatrix
Auronmatrix / aws_step_functions_history_find_first_failed_task.js
Last active March 4, 2020 17:50
AWS Step Functions: Find first failed task in history list
// For those that are annoyed that the AWS Step function history UI doesn't support filter
// Just paste this into your browser console and grab a coffee
if (!window.btn) { window.btn = document.getElementsByClassName('sfn-history-load-more-container')[0].children[0].children[0] }; var failed = Array.from(document.querySelectorAll('span')).find(el => el.textContent === 'TaskFailed'); var clickAndFind = () => { window.btn.click(); window.btn.scrollIntoView(); var failed = Array.from(document.querySelectorAll('span')).find(el => el.textContent === 'TaskFailed'); if (failed) { console.log("found failed"); failed.scrollIntoView(); document.getElementsByClassName("awsui-app-layout__content")[0].style.backgroundColor = "tomato" } else { console.log("no failed found. Trying again later"); window.setTimeout(clickAndFind, 800) }}; clickAndFind();
@Auronmatrix
Auronmatrix / release.sh
Created November 18, 2019 17:29
Bash Python Release Bump and Tag
#!/bin/bash
echo "---------Existing Tags---------"
git show-ref --tags -d
echo "-------------------------------"
function increase_version() {
python - "$1" "$2" <<EOF
import sys
@Auronmatrix
Auronmatrix / git-get-branch-all.sh
Last active September 10, 2019 08:05
get-branch-of-all-git-repos-in-subfoldera
#!/bin/bash
LOOK_FOR='.git'
find . -name $LOOK_FOR -print0 | xargs -0 -n1 dirname | sort --unique | while read fname; do
(
cd $fname
echo $(git rev-parse --abbrev-ref HEAD) " | " $fname
)
done
#!/bin/bash
LOOK_FOR='.git'
find . -name $LOOK_FOR -print0 | xargs -0 -n1 dirname | sort --unique | while read fname; do
(
cd $fname
git pull
)
done
@Auronmatrix
Auronmatrix / setup.md
Last active July 15, 2019 15:36
Setup CentOS 7
@Auronmatrix
Auronmatrix / fetch-tags-recursive.sh
Last active June 28, 2019 14:01
Get Directory Tags
#!/bin/bash
# Update all git directories below current directory or specified directory
# Skips directories that contain a file called .ignore
function update {
local d="$1"
if [ -d "$d" ]; then
if [ -e "$d/.ignore" ]; then
echo "Ignoring $d"
else
@Auronmatrix
Auronmatrix / README.md
Last active June 26, 2019 07:50
DASH - Difficulty Drop (v0.13.3) after DIP8 Activation - Potential Network Segmentation

DASH Difficulty Drop Post Mortem & Potential Network Segmentation

Issue

Around 17.06.2019 our DASH node started showing some strange behaviour. When requesting blocks from the node, their reported difficulty was around ~50x lower than the actual network.

Average Daily Dash Difficulty

|Date | Difficulty|

# Must be run as sudo
# Install Java 1.8
## Download Java tar and extract
cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz"
tar xzf jdk-8u201-linux-x64.tar.gz
## Configure alternatives
cd jdk1.8.0_201/
@Auronmatrix
Auronmatrix / gist:efd8925a1ae02e93eb6a837415b96f80
Created January 24, 2019 13:23
Check certificate expiration
openssl x509 -enddate -noout -in certificate.pem