Skip to content

Instantly share code, notes, and snippets.

View agu3rra's full-sized avatar
🧠
"Let chaos reign, then reign in chaos."

Andre Guerra agu3rra

🧠
"Let chaos reign, then reign in chaos."
View GitHub Profile
@agu3rra
agu3rra / bitlocker.ps1
Created January 20, 2023 10:45
BitLocker drive PowerShell commands
Disable-BitLockerAutoUnlock -MountPoint "E:"
Lock-Bitlocker -MountPoint "E:"
@agu3rra
agu3rra / helm.sh
Created January 25, 2021 13:34
Useful Helm commands
helm repo add [name] [url]
helm repo update
helm repo list
helm install [chart-name] [repo-name/chart]
helm show chart [repo-name/chart]
helm show values ...
helm ls -n [some-namespace]
helm upgrade [chart-name] [repo-name/chart]
# Deployment
@agu3rra
agu3rra / kube.sh
Last active September 29, 2020 13:36
Userful Kubernetes Commands
az aks get-credentials -g <resourceGroup> -n <clusterName>
kubectl create namespace [namespacenamehere]
kubectl config set-context --current --namespace=[namehere]
kubectl exec --stdin --tty [podname] -- [command]
kubectl create -f samplePod.yml
kubectl logs pods/[podname]
kubectl apply -f deployment.yml --record
kubectl rollout stauts deployment [namehere]
kubectl rollout history deployment [namehere]
kubectl undo deployment [namehere] --to-revision=1
@agu3rra
agu3rra / converter.py
Created September 17, 2020 16:32
Quick snippet to convert values into base64 encoding for usage with Kubernetes secrets.yml files
import yaml
import base64
# Assumes sample.yml will have a data: entry
if __name__ == '__main__':
with open('sample.yml', 'r') as fh:
stream = fh.read()
data = yaml.safe_load(stream)
for key, value in data['data'].items():
encoded = base64.b64encode(str(value).encode('utf-8')).decode('utf-8')
@agu3rra
agu3rra / coverage.sh
Created September 12, 2020 17:39
Python coverage report for pytest
pip install coverage
coverage run --omit 'venv/*' -m pytest
coverage report -m
@agu3rra
agu3rra / cmd.sh
Created September 5, 2020 23:16
Find and remove openjdk version from Ubuntu
apt list | grep jdk
sudo apt remove <program-name-here>
@agu3rra
agu3rra / key.sh
Created May 19, 2020 10:36
Create a pair of aync encryption keys
ssh-keygen -b 4096 -t rsa -C <youremail@domain.com>
@agu3rra
agu3rra / install.sh
Last active September 30, 2022 18:38
Installing .deb packages
sudo dpkg -i <installer>.deb
@agu3rra
agu3rra / unix-install.md
Created March 25, 2020 10:02
Installing binaries in Unix
  1. Extract tar file and place it in /usr/local. E.g.: tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
  2. Edit your $HOME/.profile adding export PATH=$PATH:/usr/local/<extracted folder>.
  3. source .profile.
@agu3rra
agu3rra / ospath-win.py
Created March 20, 2020 10:10
Python script to ensure Windows PATH has distinct values
# Not sure why some of them appear repeated but sometimes they do.
# Since there is a limit of 1024 chars to the SETX command, this sometimes comes in handy.
import os
path = os.environ['PATH']
elements = path.split(';')
elements = set(elements)
new_path = ''
for item in elements:
new_path+='{};'.format(item)