Skip to content

Instantly share code, notes, and snippets.

View themoah's full-sized avatar

A.D. themoah

View GitHub Profile
@themoah
themoah / kubectl.sh
Created September 18, 2019 08:58
Kubectl useful cheatsheet.
# limits allocation per node
kubectl get nodes --no-headers | awk '{print $1}' | xargs -I {} sh -c 'echo {}; kubectl describe node {} | grep Allocated -A 5 | grep -ve Event -ve Allocated -ve percent -ve -- ; echo'
kubectl run echo-http --image=themoah/go-http-echo:0.1 --port=8080
kubectl expose deployment demo-app --port=80 --type=NodePort
kubectl run my-shell --rm -i --tty --image ubuntu -- bash
kubectl exec -it shell-demo -- /bin/bash
kubectl explain service --recursive

Keybase proof

I hereby claim:

  • I am themoah on github.
  • I am avivd (https://keybase.io/avivd) on keybase.
  • I have a public key ASAZYVg87mSG69YlIMyxstuevfiJ0saPSkeB6qMLHoAJCwo

To claim this, I am signing this object:

@themoah
themoah / new_gist_file_0
Last active September 6, 2017 08:56
python3 gist
if __name__ == '__main__':
main(sys.argv[1]) # The 0th arg is the module filename
if __name__ == '__main__':
unittest.main()
#!/usr/bin/env python3
Use __name__ to determine how the module is being used
@themoah
themoah / 0_reuse_code.js
Created August 19, 2017 15:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
val MAX_SIZE = 10000000
val reduceLeftStartTime = new java.util.Date
(1 to MAX_SIZE) reduceLeft (_ + _)
val reduceLeftEndTime = new java.util.Date
val reduceRightStartTime = new java.util.Date
(1 to MAX_SIZE) reduceRight (_ + _)
val reduceRightEndTime = new java.util.Date
// pre-order sorting
Visit(Node current) {
if (current == null){
return;
}
Process(current.value);
Visit(current.Left);
Visit(current.Right);
}
find (root, 3)
find(node current, Data value)
if (current.value == null) {
return null;
}
if else(current.value == value) {
return current