Skip to content

Instantly share code, notes, and snippets.

View nbrandaleone's full-sized avatar

Nick Brandaleone nbrandaleone

View GitHub Profile
@nbrandaleone
nbrandaleone / README.md
Created June 19, 2023 15:31 — forked from ryu1kn/README.md
Getting GCP access token from a service account key JSON file

Getting GCP access token from a service account key

Use your service account's key JSON file to get an access token to call Google APIs.

Good for seeing how things work, including the creation of JWT token.

To create a JWT token, you can replace create-jwt-token.sh script with tools like step.

If you just want to get an access token for a service account,

@nbrandaleone
nbrandaleone / 00_destructuring.md
Created March 3, 2022 23:21 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@nbrandaleone
nbrandaleone / promises-cljs.md
Created February 27, 2022 21:08 — forked from pesterhazy/promises-cljs.md
Promises in ClojureScript

Chaining promises

Chaining promises in ClojureScript is best done using the thread-first macro, ->. Here's an example of using the fetch API:

(-> (js/fetch "/data")
    (.then (fn [r]
             (when-not (.-ok r)
               (throw (js/Error. "Could not fetch /data")))
             (.json r)))
@nbrandaleone
nbrandaleone / eks-user-data.md
Created May 6, 2020 17:47
[Looking at User Data for EKS instances] #eks

eksctl generates a UserData script in the Launch Template attached to the node group ASG. You can inspect this UserData for an instances using the following:

$ aws ec2 describe-instance-attribute \
    --attribute userData \
    --instance-id <instance-id> | jq -r .UserData.Value | base64 -d | gzip -d

You'll see the parameter being added into the kubelet.service.d unit files.

@nbrandaleone
nbrandaleone / myip.txt
Created May 1, 2020 21:20
[get my ip] #cli
curl -X GET "https://httpbin.org/ip" -H "accept: application/json"
@nbrandaleone
nbrandaleone / arm-snippet.md
Last active April 30, 2020 15:51
[EKS on ARM] Scripts to startup EKS on ARM processors #kubernetes
@nbrandaleone
nbrandaleone / launching-rails.md
Last active March 17, 2020 18:32
Rails Launching Cheatsheet

Get Launching Cheat Sheet provided by RubyThursday.com -- updated Sept. 2017 -- Includes updates from Rails 5.1

  1. Open terminal and check versions of Ruby and Rails against production server params or to make sure you are using the most recent stable versions. $ ruby -v $ rvm list $ rvm list known $ rvm install ruby 2.4.1 $ rvm list $ ruby -v $ gem install rails
@nbrandaleone
nbrandaleone / kubectl-node-shell.md
Created February 26, 2020 19:45
[Access your Kubernetes nodes] #kubernetes

$ curl -LO https://github.com/kvaps/kubectl-node-shell/raw/master/kubectl-node_shell $ chmod +x ./kubectl-node_shell $ sudo mv ./kubectl-node_shell /usr/local/bin/kubectl-node_shell

$ kubectl node-shell ip-192-168-31-163.us-west-2.compute.internal spawning "nsenter-6t2mg4" on "ip-192-168-31-163.us-west-2.compute.internal" If you don't see a command prompt, try pressing enter. [root@ip-192-168-31-163 /]# ifconfig -a eni2b71a27c699: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9001 inet6 fe80::fcb5:7ff:fe67:10fc prefixlen 64 scopeid 0x20

@nbrandaleone
nbrandaleone / start-pod-run.md
Last active January 6, 2020 18:55
[Start a pod using kubectl run] #kubernetes

https://kubernetes.io/docs/reference/kubectl/conventions/

Version 1.4 1.3 1.2 1.1
Pod --restart=Never --restart=Never --generator=run-pod/v1 --restart=OnFailure OR --restart=Never
Replication Controller --generator=run/v1 --generator=run/v1 --generator=run/v1 --restart=Always
Deployment --restart=Always --restart=Always --restart=Always N/A
Job --restart=OnFailure --restart=OnFailure --restart=OnFailure OR --restart=Never N/A
Cron Job --schedule=