Skip to content

Instantly share code, notes, and snippets.

View piaverous's full-sized avatar
🐠
·.¸.·´¯`·.¸><(((º>

Pierre Averous piaverous

🐠
·.¸.·´¯`·.¸><(((º>
View GitHub Profile
@piaverous
piaverous / setup_ssh_agent_with_apple_keychain.sh
Last active April 26, 2022 01:31
A simple bash snippet to add to your .bashrc or .zshrc in order to easily load password protected SSH Keys from the Apple Keychain, and never worry about them again !
###
# SSH keys setup with Apple keychain
###
if [ -z "$SSH_AUTH_SOCK" ] && [ -z "$SSH_AGENT_PID" ]; then
# If no SSH Agent is running, start one and load keys from Apple keychain
eval `ssh-agent -s` &> /dev/null
ssh-add --apple-load-keychain &> /dev/null
else
if [ -z "$(ssh-add -l | grep SHA256)" ]; then
# If agent is running but has no keys, load keys from Apple keychain

Terminal Special Bindings in MacOS Terminal app

I really wanted to be able to use Option + Left or Option + Right to navigate through words in terminal input. Option + Delete to delete a word is also really handy.

The Terminal App has this feature of using the Option key as a "Meta" key. This unlocks all of those great shortcuts ! This article highlights the shortcuts that are unlocked like this : https://www.shell-tips.com/mac/meta-key/

However this breaks some useful basic shortcuts, like all those used to write unicode characters. The pipe character for instance, printed by Command + Option + L cannot be used anymore when this option is enabled.

import Adafruit_DHT
import time
SENSOR_TYPE = Adafruit_DHT.DHT11
GPIO_PIN_NUMBER = 4
if __name__ == "__main__" :
start_time = time.time()
humidity, temperature = Adafruit_DHT.read_retry(
SENSOR_TYPE,
[[source]]
url = "https://www.piwheels.org/simple"
verify_ssl = true
name = "piwheels"
[requires]
python_version = "3.7"
[scripts]
measure = "python main.py"
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
clusterName: cluster.local
kubernetesVersion: v1.18.6
controlPlaneEndpoint: 192.168.1.28:6443
certificatesDir: /etc/kubernetes/ssl
apiServer:
extraArgs:
anonymous-auth: "True"
authorization-mode: Node,RBAC
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://fr.archive.ubuntu.com/ubuntu/ bionic main restricted
# # Major bug fix updates produced after the final release of the
# # distribution.
deb http://fr.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
@piaverous
piaverous / kubeadm_join_cluster.sh
Created May 25, 2020 15:10
Join a Kubernetes cluster as a Worker node with kubeadm
kubeadm join <control-plane-host>:<control-plane-port> --token <token> --discovery-token-ca-cert-hash sha256:<hash>
@piaverous
piaverous / kubeadm_init_logs.sh
Created May 25, 2020 15:09
kubeadm initialization logs
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a Pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
@piaverous
piaverous / kubeadm_install.sh
Created May 25, 2020 15:08
Install kubeadm components
# If you don't have curl yet, install it
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
# Add the google cloud package repository to your sources
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
# Install components
@piaverous
piaverous / install_docker.sh
Last active July 4, 2020 13:15
Install docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# If you want to be able to use docker as a non-root user, you can your user to the "docker" group like so:
sudo usermod -aG docker $USER