Skip to content

Instantly share code, notes, and snippets.

View henkin's full-sized avatar

Paul Henkin henkin

View GitHub Profile
@henkin
henkin / delete_aws_repo.sh
Created November 11, 2022 17:43
aws delete repo
aws ecr --region=us-west-2 describe-repositories | jq -r '.repositories[] | .repositoryName' | grep paul | xargs -L1 aws ecr --region=us-west-2 delete-repository --repository-name
@henkin
henkin / addf.sh
Created July 12, 2022 22:39
addf - add function
:${1?addf name 'body'}
func_filename="$FUNCS/$1"
func_body=$2
if [[ -f $func_filename ]];
then
echo "Existing found:"
highlight $func_filename --syntax bash
read -q "REPLY?Overwrite existing function?"
fi
@henkin
henkin / DebugEnvironmentTest.cs
Created May 19, 2021 18:43
xunit test dump sorted environment dotnet
using System;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
namespace Jail.Booking.ComponentTests
{
public class DebugTests
{
private readonly ITestOutputHelper _outputHelper;
@henkin
henkin / docker-run.sh
Last active October 16, 2020 20:10
docker single script in ubuntu
#!/usr/bin/env bash
set -x
chmod +x "$1"
docker build -t $1 -f- . <<EOF
FROM osexp2000/ubuntu-with-utils
COPY $1 ./
USER root
ENTRYPOINT [ "bash", "$1" ]
EOF
@henkin
henkin / match-words.sh
Created August 15, 2020 07:50
match words in a list print
awk 'NR==FNR {a[$1]++; next} $1 in a' words myfile
grep -Fw -f words myfile
#* This would extract the lines in myfile that contains the words in the file words anywhere.
#The strings in words are treated as fixed strings (not regular expressions) due to the -F option, and the -w option ensures that we only get lines that contains the exact same word (no matches of substrings in words are allowed).
#The words in the file words most be listed on separate lines.
@henkin
henkin / collapse.md
Created August 13, 2020 13:06
markdown html details summary collapse

Sample Instituional Claim

Institutional Claim Request
   {
    "contractId": "103405",
    "claimType": "HO",
@henkin
henkin / Makefile
Last active September 28, 2020 11:00
Makefile GitlabCI target gitalb make
CURRENT_DIR=$(shell pwd)
CI_COMMIT_SHORT_SHA=$(shell git rev-parse --short HEAD)
BRANCH='branch'
JOB='init-k8snet'
gci:
# 1) local gitlab-runner only pulls things that have been committed - temporarily commit
(git add . && git commit -am "gitlab CI testing - temp commit") || true
gitlab-runner exec docker ${JOB} \
# --env PRV_GKE_SA_KEY='/secrets/gcloud-key.json' \
@henkin
henkin / git-to-https.sh
Last active March 19, 2020 21:00
Set Git remote origin to Https
#!/usr/bin/env bash
# chmod +x this script, put it in the parent directory, then call it with something like:
# for d in */; do; cd "$d" && bash ../git-to-https.sh && cd ..; done
# eg. if you have /src/repo1, /src/repo2, then put the script into /src, and run the loop from /src
# you have to run it within a separate Bash instance because it uses 'exit' :) hence `bash ../git-to-https.sh`
OUR_GIT_SERVER="gitlab.humanaedge.com"
DIRNAME=`basename $PWD`
@henkin
henkin / zglobtest.sh
Last active December 21, 2019 06:51
ZSH zshell glob test condition select
print -l zsh_demo/*/*(e:'[[ ! -e $REPLY/malta ]]':)
# https://reasoniamhere.com/2014/01/11/outrageously-useful-tips-to-master-your-z-shell/
@henkin
henkin / wait-dns-ip.sh
Created November 22, 2019 23:01
Wait for DNS to resolve, return IP #gcp #dns
#!/bin/bash
# Usage:
# wait-dns-ip.sh <hostname>
# eg: wait-dns-ip.sh host.foo.com
#
# Will timeout after 5minutes (5 * 60 tries * 1 sec wait = 300 secs)
DNS_IP=""
COUNTER=0
while [ -z $DNS_IP ] && [ $COUNTER -lt 300 ]; do
DNS_IP=$(nslookup $1.humanaedge.io | awk '/^Address: / { print $2 }')