Skip to content

Instantly share code, notes, and snippets.

View yardbirdsax's full-sized avatar

Josh Feierman yardbirdsax

View GitHub Profile
@yardbirdsax
yardbirdsax / install-python.sh
Last active August 10, 2020 16:48
Helpful Docker build scripts
# Usage
# ./install-python.sh 3.7.8
#
# Easy install using `curl`:
# curl
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev \
&& curl -L https://www.python.org/ftp/python/$1/Python-$1.tgz -o Python-$1.tgz \
&& tar xvf Python-$1.tgz \
@yardbirdsax
yardbirdsax / aws-get-auth-token.sh
Created February 4, 2020 17:27
AWS Get Auth Token with MFA
# This script calls the AWS STS API and retrieves a temporary session token.
usage()
{
cat <<EOM
Usage: \$(aws-get-auth-token <auth token here>)
It's important to call as shown above with the dollar sign, so that the command generated by the script gets executed.
@yardbirdsax
yardbirdsax / create-cognito-users.py
Created January 29, 2020 17:01
Creating Cognito users from a JSON export
#! /usr/bin/env python3
import boto3
import botocore
import json
import argparse
from pprint import pprint
# import sys
@yardbirdsax
yardbirdsax / sample-pipline.yaml
Last active January 29, 2020 14:13
A sample YAML file for Azure Pipelines to collect and publish code coverage statistics for .NET Core projects.
name: $(Date:yyyyMMdd)$(Rev:.r)
trigger:
batch: true
branches:
include:
- release/*
- master
- develop
stages:
- stage: TestAndBuild
@yardbirdsax
yardbirdsax / set-s3-access-logging.py
Created January 17, 2020 16:34
Set S3 Access Logging Across Multiple S3 Buckets
#!/usr/bin/env python3
import boto3
import botocore
import argparse
from pprint import pprint
import re
import logging
parser = argparse.ArgumentParser(description="Sets S3 Access Logging configuration on all buckets within an account matching a certain pattern.")
@yardbirdsax
yardbirdsax / startCodeBuild.sh
Last active July 3, 2024 07:07
Start AWS Codebuild pipeline from command prompt and wait
#!/bin/bash
error_exit()
{
echo "$1" 1>&2
exit 1
}
CODEBUILD_PROJECT_NAME=$1
@yardbirdsax
yardbirdsax / tune.sql
Created January 3, 2020 17:52
Performance tuning MySQL queries
SET @@profiling = 0;
SET @@profiling_history_size = 0;
SET @@profiling_history_size = 100;
SET profiling = 1;
-- query here
SET profiling = 0;
SHOW profiles;
@yardbirdsax
yardbirdsax / Remove-AzRecoveryVault.ps1
Created November 19, 2019 19:22
Removing an Azure Recovery Vault
$vault = Get-AzRecoveryServicesVault -ResourceGroupName euw-dbclus02 -Name euw-dbclus02-recoveryvault
$container = Get-AzRecoveryServicesBackupContainer -VaultId $vault.ID -ContainerType AzureVM
$PI = Get-AzRecoveryServicesBackupItem -Container $container -WorkloadType AzureVM -VaultId $vault.ID
Disable-AzRecoveryServicesBackupProtection -Item $PI -VaultId $vault.ID
@yardbirdsax
yardbirdsax / docker-bind-mount-non-root.sh
Last active October 5, 2019 20:15
How to have bind-mount volumes in Docker owned by non root users
#!/bin/bash
chown -R demo:demo /data
if [ -z "$RUNAS" ]
then
exec runuser -u demo "$@"
else
exec "$@"
fi