Skip to content

Instantly share code, notes, and snippets.

View rms1000watt's full-sized avatar

Ryan M Smith rms1000watt

View GitHub Profile
@rms1000watt
rms1000watt / delete-rc-tags-in-git-repos.sh
Created October 17, 2019 22:46
Delete RC Tags in Git/Github Repos
#!/usr/bin/env bash
git fetch --tags --all
for tag in $(git tag -l); do
if ! echo "${tag}" | grep -q "\-rc"; then
continue
fi
echo
@rms1000watt
rms1000watt / openssl-full-chain-trust-website.sh
Last active May 13, 2025 17:05
Openssl get full chain of trust from website
# The first one in that file is the actual cert of the website
# The following ones in that file is the chain. Possibly this should separate full-chain.pem to chain.pem + cert.pem
openssl s_client -host www.google.com -port 443 -showcerts 2>&1 | sed -n '/BEGIN CERTIFICATE/,/END CERTIFICATE/p' > ~/Desktop/full-chain.pem
@rms1000watt
rms1000watt / curl-datadog-udp-metric.sh
Created September 30, 2019 22:00
cURL Datadog UDP Metric
# Courtesy of: https://gist.github.com/nstielau/966835
echo "deploys.test.myservice:1|c" | nc -w 1 -u datadog.kube-system 8125
@rms1000watt
rms1000watt / sls-aws-assume-role.sh
Created September 19, 2019 22:16
Serverless + AWS Assume Role Profiles fix
# Kudos: https://github.com/serverless/serverless/issues/3833#issuecomment-389739007
export AWS_SDK_LOAD_CONFIG=1
@rms1000watt
rms1000watt / update-helm-state.sh
Last active November 5, 2019 07:51
Edit helm state.. update the release status of a helm deployment
go get github.com/helm/helm
cd $(go env GOPATH)/src/github.com/helm/helm/_proto
kubectl -n kube-system get cm hello-world.v1 -o yaml | grep release | cut -d' ' -f4 | base64 -D | gunzip | protoc --decode hapi.release.Release hapi/**/* > ~/Desktop/hello-world.v1.protod
# Edit this file to DEPLOYED
cat ~/Desktop/hello-world.v1.protod | protoc --encode hapi.release.Release hapi/**/* | gzip | base64 | pbcopy
kubectl -n kube-system edit cm hell-world.v1
# Update the release with the value in your clipboard
# Also update metadata.labels.STATUS to DEPLOYED so the protobuf matches this label STATUS
helm ls
@rms1000watt
rms1000watt / create-table-partitions.sh
Created August 30, 2019 18:50
Create Table and Partitions in Athena via AWS CLI bash
aws athena start-query-execution \
--query-string "$(cat create-table.sql)" \
--query-execution-context Database=someathenadatabase \
--result-configuration OutputLocation=s3://some-s3-bucket-for-athena-results/aws-cli
# Do this multiple times for each partition.. probably jinja2 script it
aws athena start-query-execution \
--query-string "ALTER TABLE table_1 ADD PARTITION (year='2019',month='4',day='1') location 's3://some-bucket-where-structured-data-is/path/2019/4/1';" \
--query-execution-context Database=someathenadatabase \
--result-configuration OutputLocation=s3://some-s3-bucket-for-athena-results/aws-cli

Keybase proof

I hereby claim:

  • I am rms1000watt on github.
  • I am rms1000watt (https://keybase.io/rms1000watt) on keybase.
  • I have a public key whose fingerprint is 81F4 1CB1 A75E 500C 47B9 EAE6 C47E 8B5C 73FD A8EE

To claim this, I am signing this object:

@rms1000watt
rms1000watt / config.opvn
Last active August 12, 2019 20:57
Pritunl Client Redirect all traffic through VPN
# Courtesy of: https://forums.openvpn.net/viewtopic.php?t=21476
....
redirect-gateway def1
...
@rms1000watt
rms1000watt / exec-command-std.go
Created August 5, 2019 20:48
Golang exec command with stdout, stderr, stdin
package main
import (
"os"
"os/exec"
)
func main() {
var name string
var args []string
@rms1000watt
rms1000watt / remove-redundant-whitespace.go
Created July 30, 2019 19:24
Golang Remove all redundant whitespace inside string
// https://stackoverflow.com/a/42251527
t := "hello world friends"
t = strings.Join(strings.Fields(t), " ")