This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Get cloudflare dns record IDs for cnames in zescrow.com - redirect to a file | |
API_KEY="xxxxxxxxxxxxxxxxxx" | |
ZONE_ID="xxxxxxxxxxxxxxxxxx" | |
API_URL="https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records?type=CNAME" | |
#Change page as necessary | |
curl -s -X GET "${API_URL}&page=4" \ | |
-H "Authorization: Bearer ${API_KEY}" \ | |
-H "Content-Type: application/json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This doesn't work well with paging in CLI v2 - do this too: | |
# export AWS_PAGER="" | |
BUCKET_NAME=argocdexport | |
OBJECT_KEY=export.yaml | |
versions=$(aws s3api list-object-versions --bucket $BUCKET_NAME --prefix $OBJECT_KEY | jq -r '.Versions[].VersionId') | |
count=`echo $versions |jq 'length'`-1 | |
echo "Retrieved $count versions" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
kubectl get pods --all-namespaces -o custom-columns=":metadata.namespace,:metadata.name,:spec.nodeName" --no-headers=true | while read -r namespace pod_name node_name | |
do | |
zone=$(kubectl get node "$node_name" -o jsonpath="{.metadata.labels.topology\.kubernetes\.io/zone}") | |
echo "Namespace: $namespace, Pod Name: $pod_name, Node Name: $node_name, Zone: $zone" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Start out on the branch with the code we want | |
git checkout branch_a | |
#create tmp branch same as branch_a (so that we don't change our local branch_a state during the operation) | |
#working directory has all the code that we want, on tmp branch | |
git checkout -b tmp | |
# Change the branch head to the branch we want to be on. All the delta | |
# between the current source code and branch_b is now staged for commit | |
git reset --soft branch_b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on: https://developer.hashicorp.com/terraform/tutorials/automation/github-actions | |
name: Terraform plan on PR and apply on merge | |
on: | |
pull_request: | |
types: [opened, closed, synchronize, reopened] | |
paths: | |
- "environment/**" | |
jobs: | |
terraform_plan: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param($kubecontext) | |
if ($kubecontext -ne $null){ | |
kubectl config use-context $kubecontext | |
} | |
else { | |
$kubecontext = kubectl config current-context | |
} | |
$response = Read-Host "Are you sure you want to restart all pods in $kubecontext ? Type YES to continue" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Port-forward a k8s service | |
k port-forward svc/argo-cd-argocd-server 12345:443 -n argocd | |
Get shell on a pod | |
k -n [namespace] exec -i -t [argocd server pod name] -- /bin/bash | |
add --container param for specific container | |
List all non-running pods | |
k get pods --field-selector status.phase!=Running -A | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# List terraform resources in the current directory and ask their arn to import them into terraform state | |
RESOURCES_LIST=$(awk -F\" '/^resource "/ {print $2"."$4}' *.tf) | |
for resource in ${RESOURCES_LIST} | |
do | |
read -p "Enter ARN for resource ${resource} (type none to not import it): " arn | |
if [[ ${arn} != "none" ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"devDependencies": { | |
"bower": "~0.6.4", | |
"underscore" : "~1.4.4", | |
"grunt" : "0.4.0rc4", | |
"grunt-cli" : "~0.1.5", | |
"grunt-contrib-clean" : "~0.4.0a", | |
"grunt-contrib-coffee" : "git+https://github.com/gruntjs/grunt-contrib-coffee.git#01f90adb16e315ee88c0befa5bb401bbfd4cbc6e", | |
"grunt-contrib-concat" : "~0.1.1", | |
"grunt-contrib-connect" : "0.1.0", | |
"grunt-contrib-copy" : "git+https://github.com/gruntjs/grunt-contrib-copy.git#2bd6f0e99e6be6f4bc48f50e5cb32ff8aa3f8ffc", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ObjRepository : IObjRepository | |
{ | |
public Obj Add(Obj newObj) | |
{ | |
Audited<Obj> newAuditedObj = new AuditPersist.Audited<Obj>(Obj newObj); | |
Audited<Obj> persistedAuditedObj = CI.Add<Audited<Obj>>("objbucket", newAuditedObj); | |
return newAuditedObj.CurrentState(); | |
} | |
private Audited<Obj> GetAudited(Guid objId) |
NewerOlder