Skip to content

Instantly share code, notes, and snippets.

View amosshapira's full-sized avatar

Amos Shapira amosshapira

  • Sydney, Australia
View GitHub Profile
@amosshapira
amosshapira / export-all-k8s-resources.sh
Created September 13, 2022 23:54
Export all K8s resources
#!/bin/env bash
## Source: https://github.com/kubernetes/kubernetes/issues/24873#issuecomment-416689257
## https://github.com/kubernetes/kubernetes/issues/24873#issuecomment-416189335
# This version excludes service account tokens from the export
i=$((0))
for n in $(kubectl get -o=custom-columns=NAMESPACE:.metadata.namespace,KIND:.kind,NAME:.metadata.name pv,pvc,configmap,ingress,service,secret,deployment,statefulset,hpa,job,cronjob --all-namespaces | grep -v 'secrets/default-token')
do
@amosshapira
amosshapira / clone-all-gh.sh
Last active March 9, 2021 04:30
Bash script to clone all repositories of a given GitHub organisation
#!/usr/bin/env bash
# "CLONE_ALL_GH_TOKEN" should be a Personal Token from https://github.com/settings/tokens
# with scope "repo"
ORG=<YOUR_ORG_NAME_HERE>
GIT_OUTPUT_DIRECTORY=${1:-"$HOME/github"}
echo Cloning to $GIT_OUTPUT_DIRECTORY
# "100" is the maximum adhered to by GitHub
PER_PAGE=100
@amosshapira
amosshapira / AuthyToOtherAuthenticator.md
Created February 24, 2021 07:51 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

@amosshapira
amosshapira / instructions.md
Last active August 7, 2019 21:24 — forked from ba11b0y/instructions.md
Minikube Installation on Ubuntu 18.04 which really works!

Installation of Minikube with kvm2 driver which really works!

Disclaimer: Tried on Ubuntu 18.04 LTS

Installation of minikube

  • Apparently installation from snap doesn't work as expected, use curl for installation of the latest version.

  • curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

  • sudo install minikube-linux-amd64 /usr/local/bin/minikube

@amosshapira
amosshapira / introrx.md
Created June 21, 2019 04:35 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@amosshapira
amosshapira / sprintrole-verification.txt
Created March 31, 2019 17:30
springrole.com verification
f7be86d295858e09e63eee11f0859653d6d3f302775a2fc23223dbfeaf261976f612e38456d6ec9c2e9955c65c0736606446640e42a6af7284bd7efd58c42418
set hostnames to {"web01", "sys01", "mem01", "redis01"}
if application "iTerm" is running then
tell application "iTerm"
create window with default profile
tell current tab of current window
select
tell current session
-- make the window fullscreen
@amosshapira
amosshapira / whisper max archive
Last active February 10, 2018 10:29
Example (untested) of tracking maximum value of metric in the past year.
Ref: http://graphite.readthedocs.io/en/latest/config-carbon.html#storage-schemas-conf
storage-schemas.conf:
[year_max]
pattern = yearMax$
retentions = 1y:1y
storage-aggregation.conf:
@amosshapira
amosshapira / delete-jenkins-queue.groovy
Created May 5, 2017 04:56
Delete all tasks in Jenkins queue
import hudson.model.*
def q = Jenkins.instance.queue
q.items.findAll().each { q.cancel(it.task) }
@amosshapira
amosshapira / list-cloudfornation-stack-outputs
Last active June 22, 2017 07:48
list outputs of a CloudFormation stack in plain text format, one Output per line.
# list outputs of a CloudFormation stack in plain text format
# one output per line.
aws cloudformation describe-stacks \
--stack STACK_NAME \
--query 'Stacks[*].Outputs[*].[OutputValue]' \
--output text