Skip to content

Instantly share code, notes, and snippets.

@lightcode
lightcode / main.tf
Last active January 2, 2021 13:19
S'authentifier à Vault avec Gitlab en OIDC | https://lightcode.fr/article/vault-gitlab-oidc/
variable gitlab_url {
type = string
description = "URL to Gitlab (example: https://gitlab.example.com)"
}
variable vault_url {
type = string
description = "URL to Vault (example: https://vault.example.com)"
}
variable oidc_client_id {
type = string
@lightcode
lightcode / .gitlab-ci.yml
Last active March 14, 2024 10:30
Utiliser Vault depuis vos pipelines Gitlab CI | https://lightcode.fr/article/vault-gitlab/
demo:
image: vault:1.6.0
script:
- export VAULT_ADDR=https://vault.example.com
- export VAULT_TOKEN="$(vault write -field=token auth/gitlab-jwt/login role=read-secret-demo jwt=$CI_JOB_JWT)"
- USERNAME="$(vault kv get -field=username kv/demo/hello)"
- PASSWORD="$(vault kv get -field=password kv/demo/hello)"
- echo "The secret is ${USERNAME}:${PASSWORD}"
only:
refs: ["master"]
@lightcode
lightcode / multiple-ssh.sh
Last active October 6, 2017 13:15
Open ssh N-time in tmux and enable synchronous panes
#!/bin/bash
first=$1
shift
for e in $@; do
tmux split-window ssh $e
done
tmux set-window-option synchronize-panes on
@lightcode
lightcode / list-non-pinging-pods.sh
Created June 6, 2017 15:10
Check if pods receive pings
#!/bin/bash
PATH="$PATH:/usr/local/bin"
kubectl get po --all-namespaces -o wide | head -n 1
for ip in $(kubectl get po --all-namespaces -o "jsonpath={.items[*].status.podIP }"); do
ping -c 1 -W 3 $ip > /dev/null
[[ $? -gt 0 ]] && kubectl get po --all-namespaces -o wide | awk '$7 == "'$ip'" { print $0 }'
done
@lightcode
lightcode / OpenStack-completion-for-ZSH.md
Last active February 10, 2023 19:41
Use OpenStack client completion with ZSH

You just have to source this file.

#!/bin/bash
mkdir -p authority
CA="authority/ca.pem"
CA_KEY="authority/ca-key.pem"
CA_SRL="authority/ca.srl"
if [[ -f "$CA" ]] && [[ "$CA_KEY" ]]; then
echo "CA key and cert already exists"
@lightcode
lightcode / energy.sh
Created October 4, 2015 22:22
Power saving script
#!/bin/bash
####
# Configuration
####
SOUND_POWERSAVE_BATTERY=1
SOUND_POWERSAVE_AC=0
WIFI_IFNAME="wlp4s0"
@lightcode
lightcode / linux-audio.md
Created July 2, 2015 10:15
Commands to manipulate audio files on Linux

Convert music on Linux

Split a FLAC into small parts with a CUE file :

shnsplit -f CDImage.cue -t %n-%t -o flac CDImage.flac

Remove metadata on FLAC in a directory :