Skip to content

Instantly share code, notes, and snippets.

View leoluz's full-sized avatar

Leonardo Luz Almeida leoluz

View GitHub Profile
@leoluz
leoluz / map_check.vim
Last active November 3, 2020 03:10
vim: check maps with more details
:verbose nmap <KEY>
@leoluz
leoluz / rbac-docker4desktop.sh
Last active July 12, 2023 10:26
enable/disable RBAC in docker-for-desktop
-- enable RBAC in docker-for-desktop
k delete clusterrolebinding docker-for-desktop-binding
-- disable RBAC in docker-for-desktop
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: docker-for-desktop-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
@leoluz
leoluz / kube admin army-knife
Last active September 25, 2020 19:55
create a pod that starts a shell and stops when exiting
# Run a pod and exec into it to run curl commands. Pod will self delete on exit.
kubectl run curlpod-debug -i --tty --image=appropriate/curl --restart=Never --rm -- sh
# To run in a specific node:
apiVersion: v1
kind: Pod
metadata:
name: curlpod-debug
labels:
app: curl-debug
@leoluz
leoluz / dood.sh
Created July 2, 2019 20:05
docker-out-of-docker (DooD)
# Starts a docker container with the hosts docker daemon for doing docker tests
# https://asciinema.org/a/137139
docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -it docker /bin/sh
1215 Signing of Magna Carta in England
1497 European exploration began with the expedition of John Cabot, who was the first to draw a map of Canada’s East Coast
1534 to 1542 Jacques Cartier made three voyages across the Atlantic, claiming the land for King Francis I of France
1550s The name of Canada began appearing on maps
1604 The first European settlement north of Florida was established by French explorers Pierre de Monts and Samuel de Champlain
1608 Samuel de Champlain built a fortress at what is now Quebec City
1610 English settlement began
1670 King Charles II of England granted the Hudson’s Bay Company exclusive trading rights over the watershed draining into Hudson Bay
1700s The maple leaf was adopted as a symbol in Canada
1701 The French and the Iroquois made peace
@leoluz
leoluz / execute_cronjob.sh
Created October 19, 2018 14:47
Kubernetes: create a job from a cronjob (requires kubectl v1.10.1+)
kubectl create job --from=cronjob/<cronjob-name> <job-name>
@leoluz
leoluz / find_big_files.sh
Created October 9, 2018 03:29
Find the 25 biggest files in dir
find . -type f -exec ls -al {} \; | sort -nr -k5 | head -n 25
@leoluz
leoluz / kubeseal.sh
Created May 14, 2018 19:35
kubeseal
kubeseal --format=yaml < secret.yaml > ssecrets.yaml
### Keybase proof
I hereby claim:
* I am leoluz on github.
* I am leoluz (https://keybase.io/leoluz) on keybase.
* I have a public key ASDmkK0Xl1TeI2bnPySn-VdKjFCP418Xz24XySf9UWwnwAo
To claim this, I am signing this object:
@leoluz
leoluz / StubMappingWithScenarioJsonRecorder.groovy
Created January 13, 2016 21:05
A Wiremock listener implementation that records stubs with scenarios allowing you to playback your tests even in complex scenarios that depends on state transitions awareness.
import com.github.tomakehurst.wiremock.common.FileSource
import com.github.tomakehurst.wiremock.common.IdGenerator
import com.github.tomakehurst.wiremock.common.UniqueFilenameGenerator
import com.github.tomakehurst.wiremock.common.VeryShortIdGenerator
import com.github.tomakehurst.wiremock.http.*
import com.github.tomakehurst.wiremock.matching.RequestPattern
import com.github.tomakehurst.wiremock.matching.ValuePattern
import com.github.tomakehurst.wiremock.stubbing.Scenario
import com.github.tomakehurst.wiremock.stubbing.StubMapping