- Extract tar file and place it in
/usr/local
. E.g.: tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz - Edit your $HOME/.profile adding
export PATH=$PATH:/usr/local/<extracted folder>
. source .profile
.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run a container and expose port to host | |
docker run --name mongo-instance-01 -p 27017:27017 -d mongo:latest | |
# Access its terminal | |
docker ps | |
docker exec -it <container-id> bash | |
# Run the same mongo DB in the above example with persistence. | |
docker volume create mongo-volume-01 | |
docker run \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message = 'Divide the army in two, advance and outflank them on the right. I will advance on the left flank from the woods getting them by surprise.' | |
message = message.replace(' ','') | |
message = message.replace(',','') | |
message = message.replace('.','') | |
shift_secret = 6 | |
ciphered_message = '' | |
print(message) | |
for character in message: | |
if character.isupper(): | |
ciphered_message += chr((ord(character) + shift_secret - 65) % 26 + 65) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo dpkg -i <installer>.deb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-keygen -b 4096 -t rsa -C <[email protected]> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt list | grep jdk | |
sudo apt remove <program-name-here> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install coverage | |
coverage run --omit 'venv/*' -m pytest | |
coverage report -m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer