Skip to content

Instantly share code, notes, and snippets.

View arledesma's full-sized avatar
🐛
I may be slow to respond

Anthony Ledesma arledesma

🐛
I may be slow to respond
View GitHub Profile
@arledesma
arledesma / .awsrc
Last active December 23, 2021 04:02
generated functions for logging into aws organizations accounts
# this file should be sourced in your .bashrc or .zshrc
# aws-cli-login.sh is from infrastructure-live-customer/.tools/aws/
function sso-assume-role {
# support both bash and zsh function stack reference to get the calling function name
local -r profile="${FUNCNAME[-1]:-${funcstack[-1]}}";
pushd "$(dirname "$(command -v aws-cli-login.sh)")" &>/dev/null;
[ -n "$1" ] && source aws-cli-login.sh --sso --profile "${profile//-legacy/}" "$1";
[ -z "$1" ] && source aws-cli-login.sh --sso --profile "${profile//-legacy/}";
@arledesma
arledesma / clone-org-repositories.sh
Last active February 9, 2022 21:40
Clone all repositories from an organization.
#!/bin/bash -e
# DRY_RUN=1
readonly DEFAULT_ORG="mindstream-it";
readonly DEFAULT_GITHUB_BASE="${HOME}/src/github.com";
readonly DEFAULT_GITHUB_API_BASE="https://api.github.com/orgs";
readonly GITHUB_TOKEN_ERROR_MESSAGE="Variable must be set to the value of a PAT. See https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token for creating a PAT.";
@arledesma
arledesma / README.md
Created February 10, 2021 01:08
AWS CMS policy mapping using jq and a netcat listener

Using aws sdk's CSM to obtain an iam policy statement

Based on work in https://github.com/iann0036/iamlive Using the data in map.json from https://github.com/iann0036/sdk-iam-map

I wanted to be able to use this same type of functionality without requiring yet another tool. As I already have jq included in all of my tooling I chose to use it for simplicity -- although the language itself is not always so simple to grok.

This script will allow you to execute your commands as arguments to the script. As it is setting environment variables we are able to gain insights into any process that is built using the aws sdk's, which include the cli, cli2, and terraform.

An example of an unauthenticated call to get-caller-identity will provide.

@arledesma
arledesma / allocate-shard.sh
Last active July 28, 2017 00:33
ES scripts
#!/bin/bash
if [ -n "$1" ]; then index=$1; fi
if [ -n "$2" ]; then shard=$2; fi
if [ -n "$3" ]; then targetNode=$3; fi
curl -u es_admin:$ESPASS -sS -XPOST 'localhost:9200/_cluster/reroute' -d "{
\"commands\" : [ {
\"allocate\" : {
\"index\" : \"${index}\",
$Boxstarter.RebootOk = $true
$Boxstarter.NoPassword = $false
$Boxstarter.AutoLogin = $true
Install-WindowsUpdate -AcceptEula
choco install -y visualstudio2017community
choco install -y visualstudio2017-workload-netcoretools
choco install -y visualstudio2017-workload-data
choco install -y visualstudio2017-workload-node
choco install -y sql-server-management-studio
@arledesma
arledesma / Dockerfile
Created May 3, 2017 00:36
testing out requiretty
FROM centos:6.6
# Install sudo
RUN yum install -y sudo \
# Clean up yum
&& yum clean all
# Add a test user
RUN adduser test -G wheel \
# Set the test users password to test
@arledesma
arledesma / Add BindingRedirect to all app.config's for projects in solution
Last active April 3, 2017 20:12
Remove All AssemblyBindings from app.config files within source/$project/ and Add BindingRedirect to all projects in solution
# Run from within Package Manager Console
Get-Project –All | Add-BindingRedirect
@arledesma
arledesma / keybase.md
Created March 21, 2016 21:10
my keybase proof

Keybase proof

I hereby claim:

  • I am arledesma on github.
  • I am aledesma (https://keybase.io/aledesma) on keybase.
  • I have a public key whose fingerprint is 460D 3D9F AA8E B61F 10AE A46B 8650 B8ED A13F C66D

To claim this, I am signing this object:

@arledesma
arledesma / Dockerfile
Created November 4, 2015 21:38
Dockerfile for cross-compiling and packaging
#
# Cross-compile go with fpm for packaging rpm and deb files
#
FROM ubuntu:trusty
#
# https://hub.docker.com/r/neroinc/ubuntu-crosscompile/
#
# Packaged dependencies
RUN apt-get update