Skip to content

Instantly share code, notes, and snippets.

Avatar

André Pires andreppires

View GitHub Profile
@andreppires
andreppires / readme.md
Created October 15, 2019 12:53
[Kubernetes Hacks] List of tools and command to save when I you are stuck
View readme.md
  • Delete a stucked namespace that is not deleted with grace-period=0 --force
(
NAMESPACE=your-rogue-namespace
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
)

Props to nobar: https://stackoverflow.com/a/53661717/6240029

View keybase.md

Keybase proof

I hereby claim:

  • I am andreppires on github.
  • I am andreppires (https://keybase.io/andreppires) on keybase.
  • I have a public key ASC6wAPwzMAZG4ud-6s3PqoJvLdcTQzyBrmp7NuO-72Slwo

To claim this, I am signing this object:

@andreppires
andreppires / pgadmin.sh
Created May 3, 2019 17:01
[PgAdmin4] Run PgAdmin via docker
View pgadmin.sh
docker run -p 80:80 \
-e "PGADMIN_DEFAULT_EMAIL=user@domain.com" \
-e "PGADMIN_DEFAULT_PASSWORD=SuperSecret" \
-d dpage/pgadmin4
# Go to http://127.0.0.1 to access pgadmin. Email and password in the command above
@andreppires
andreppires / k8-net_plugins.md
Created February 14, 2019 14:40
[Kubernetes Network Plugins and Policies]
View k8-net_plugins.md

Kubernetes allow various flavours:

  • Kubenet: the default one, implements basic cbr0 using the bridge and host-local CNI plugins;
  • Calico: your default choice since it is good for various purposes. Don’t forget to set the MTU in the ConfigMap if you are using jumbo frames.
  • Cilium: for security reasons this could be your option. Also it seems to be more easy to configure network policies than calico.
  • Flannel: You have low resource nodes in your cluster (only few GB of RAM, few cores) and you don’t need security features, go with flannel.
  • Weave Net: if you need to encrypt your network for security reasons, go with WeaveNet. Don’t forget to set your MTU size if you are using jumbo frames and activate encryption by giving a password in an environment variable. But then again, forget about performance, this is the price for encryption.
@andreppires
andreppires / lepton.desktop
Last active March 26, 2019 23:19
[Lepton desktop entry] Lepton - A Lean GitHub Gist Client http://hackjutsu.com/Lepton/
View lepton.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Lepton
Comment=A Lean GitHub Gist Client
Exec=/home/andreppires/Programs/Lepton/Lepton-1.7.3-x86_64.AppImage
Icon=/home/andreppires/Programs/Lepton/logo.png
#Logo here: http://hackjutsu.com/Lepton/img/logo.png
Terminal=false
@andreppires
andreppires / postman.desktop
Last active January 29, 2019 11:36
[Postman desktop entry] Add postman to the applications' menu
View postman.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Postman
Comment=API Development Environment
Exec=<extracted-Postman-folder>/Postman
Icon=<extracted-Postman-folder>/app/resources/app/assets/icon.png
Terminal=false
@andreppires
andreppires / delete_raw.sh
Last active January 29, 2019 11:40
[Delete crappy (raw) photos] I shoot photos in RAW and JPG. To delete unnecessary raw files I delete the bad JPG photos doing a preview to all photos. Then I run this script to remove the raw files too.
View delete_raw.sh
for x in *.CR2
do
echo $x
FILE="./"${x%.*}".JPG"
echo "File= "$FILE
if [ -f "$FILE" ];
then
echo "File $x exist"
else
echo "File $x does not exist. Removing."
@andreppires
andreppires / calcForPrint.py
Last active January 29, 2019 11:37
[Printer: Font and back] A simple script in python to calculate the front pages and the back pages depending in the initial page, the final page and the number of pages per side.
View calcForPrint.py
#read firt page
first= int(raw_input('First page to print? : '))
#read last page
last= int(raw_input('Last page to print? : '))
#pages the front
pages= int(raw_input('Pages per side? : '))
result={}
key='a'
result.setdefault(key, [])
key='b'
@andreppires
andreppires / franz.desktop
Last active January 29, 2019 11:37
[Franz desktop entry] Add Franz to the applications' menu
View franz.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Franz
Comment=Message aggregator
Exec=/home/andreppires/tools/Franz-linux-x64-3.0.2/Franz
Icon=/home/andreppires/tools/Franz-linux-x64-3.0.2/resources/app.asar.unpacked/assets/franz.png
Terminal=false