Skip to content

Instantly share code, notes, and snippets.

View RyanJarv's full-sized avatar
🖤

Ryan Gerstenkorn RyanJarv

🖤
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ryanjarv on github.
  • I am jarv (https://keybase.io/jarv) on keybase.
  • I have a public key ASACfHGzgHATBhGVD2yHMqxR3spcvlku-I6NFddD4sKAwwo

To claim this, I am signing this object:

@RyanJarv
RyanJarv / msh_example.md
Last active November 24, 2020 04:42
Example of msh building and running dockerfiles

Echo Example

% cat echo.msh                              
#!/usr/local/bin/msh exec docker build -t {{.Name}} -f {{.Path}} {{.ContextDir}}; docker run {{.Name}} hello world
FROM alpine:3
ENTRYPOINT ["echo"]
% ./echo.msh                               
@RyanJarv
RyanJarv / gist:f7fdc434b36c3545e006fe6c1eb5c555
Created December 4, 2020 03:11
Count AWS API's by year
#!/usr/bin/env bash
#
# Count AWS API's on the closest commit before a specific date by year. This takes into account
# different versions of the same API and only uses the newest.
#
set -euo pipefail
day="12-01"
for y in $(seq 2020 2015); do
@RyanJarv
RyanJarv / gist:addf4ee61f0d228642cad6b01049d113
Created December 4, 2020 03:14
Get AWS service count by year (botocore)
for y in $(seq 0 8); do git checkout -q `git rev-list -1 --before="$(date -v-${y}y)" master`; git show --no-patch --no-notes --pretty="%as"|tr -d '\n'; { find -E botocore/data -type d -mindepth 1 -maxdepth 1 -not -path botocore/data/aws; find -E botocore/data/aws -type d -mindepth 1 -maxdepth 1; find -E botocore/data/aws -type file -regex '.*/[^/_]*.json' -mindepth 1 -maxdepth 1; } 2>/dev/null|wc -l; sleep 0.2 ; done
package main
import (
"bytes"
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/smithy-go/middleware"
@RyanJarv
RyanJarv / gist:fdc165e1b90cfe39325d958814510fbe
Created January 23, 2022 23:30
One liner for downloading home brew bottles
# Oneliner for copy/paste:
#
# NAME=libtool VERSION=2.4.6_4; OSX_CODENAME=big_sur; curl -o "${NAME}-${VERSION}.${OSX_CODENAME}.bottle.tar.gz" -L -H 'Authorization: Bearer QQ==' -XGET "https://ghcr.io/v2/homebrew/core/${NAME}/blobs/sha256:$(curl -H 'Accept: application/vnd.oci.image.index.v1+json' -H 'Authorization: Bearer QQ==' -XGET https://ghcr.io/v2/homebrew/core/${NAME}/manifests/${VERSION} | jq '.manifests|.[]|select(.annotations."org.opencontainers.image.ref.name" == "'"${VERSION}.${OSX_CODENAME}"'")|.annotations."sh.brew.bottle.digest"' -r)"
#
# Formatted version:
NAME=libtool
VERSION=2.4.6_4
OSX_CODENAME=big_sur
GetAccessKeyLastUsedRequest: ["AccessKeyId"]
GetContextKeysForCustomPolicyRequest: ["PolicyInputList"]
GetContextKeysForPrincipalPolicyRequest: ["PolicySourceArn"]
GetGroupRequest: ["GroupName"]
GetGroupPolicyRequest: ["GroupName","PolicyName"]
GetInstanceProfileRequest: ["InstanceProfileName"]
GetLoginProfileRequest: ["UserName"]
GetOpenIDConnectProviderRequest: ["OpenIDConnectProviderArn"]
GetOrganizationsAccessReportRequest: ["JobId"]
GetPolicyRequest: ["PolicyArn"]
#!/usr/bin/env python
import json
from dataclasses import dataclass
from pathlib import Path
from typing import List, Dict, Literal, Union, Optional
import typer
# Works in bash, zsh untested
function assume() {
SOURCE_IDENTITY=""
TAG=""
RST="\033[0m"
GRN="\033[32m"
RED="\033[31m"