Skip to content

Instantly share code, notes, and snippets.

View leucos's full-sized avatar
👽
Waiting for aliens

Michel Blanc leucos

👽
Waiting for aliens
  • devops.works
  • Lyon, France
View GitHub Profile
@leucos
leucos / keybase.md
Created June 3, 2015 05:38
keybase.md

Keybase proof

I hereby claim:

  • I am leucos on github.
  • I am leucos (https://keybase.io/leucos) on keybase.
  • I have a public key whose fingerprint is FA67 4EDA D648 9E50 BFA4 3F29 FDF5 4971 24B3 5C22

To claim this, I am signing this object:

@leucos
leucos / clean_vault
Last active February 19, 2019 16:46
Ansible vault transparent encryption revisited
#!/bin/sh
if [ ! -r '.vault_password' ]; then
exit 1
fi
tmp=`mktemp`
cat > $tmp
ansible-vault encrypt $tmp --vault-password-file=.vault_password > /dev/null 2>&1
@leucos
leucos / specs.sh
Last active November 30, 2017 12:56
Spec script for Ansible CI with RoleSpec
#!/bin/bash
#
# CI provisionning script
#
# This script will prepare CI run environments for Ansible roles
# It can be used in Travis or Vagrant
#
# It will also install itslef in /usr/local/bin/spec for subsequent runs in
# Vagrant
#
@leucos
leucos / post-commit
Created May 25, 2015 15:57
Transparent encryption/decryption with pre-commit and post-commit hooks
#!/bin/sh
#
# Post-commit hook that decrypts files containing '$ANSIBLE_VAULT'
#
# File should be .git/hooks/post-commit and executable
CRYPT_TAG='^\$ANSIBLE_VAULT'
EXIT_STATUS=0
wipe="\033[1m\033[0m"
@leucos
leucos / .git_hooks_pre-commit
Last active March 27, 2025 21:36
ansible-vault pre-commit hook
#!/bin/bash
#
# Pre-commit hook that verifies if all files containing 'vault' in the name
# are encrypted.
# If not, commit will fail with an error message
#
# Original author: @ralovely
# https://www.reinteractive.net/posts/167-ansible-real-life-good-practices
#
# File should be .git/hooks/pre-commit and executable
@leucos
leucos / do_boot2.sh
Last active December 26, 2023 17:54
Bootstrap your DO infrastructure unsing Ansible without dynamic inventory (version for Ansible v2.0+ and DO API v2.0)
#!/bin/bash
#
# What is that
# ============
#
# This script will help you setting up your digital ocean
# infrastructure with Ansible v2.0+ and DO API v2
#
# Usually, when working with DO, one is supposed to use digital_ocean.py
# inventory file, and spin up instances in a playbook.
@leucos
leucos / do_boot.sh
Last active July 4, 2018 20:46
Bootstrap your DO infrastructure unsing Ansible without dynamic inventory
#!/bin/bash
#
# What is that
# ============
#
# This script will help you setting up your digital ocean
# infrastructure with Ansible
#
# Usually, when working with DO, one is supposed to use digital_ocean.py
# inventory file, and spin up instances in a playbook.
@leucos
leucos / arch_uefi_bootloader_fix.sh
Last active August 29, 2015 14:16
Recover from Arch bootloader crash - Asus UX51VZA
# Boot in UEFI mode !!
loadkeys fr
mount /dev/md125p3 /mnt
arch-chroot /mnt /bin/bash
mount /dev/md125p1 /boot/efi/
pacman -S linux
pacman -S grub
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub_uefi --recheck
grub-mkconfig -o /boot/grub/grub.cfg
umount /boot/efi
@leucos
leucos / check_and_patch.yml
Last active August 29, 2015 14:14
Ghost vulnerability check tool (CVE-2015-0235)
# Ansible playbook to check for CVE-2015-0235
#
# Check mode only
# ansible-playbook check_and_patch.yml
#
# To apply the fix :
# ansible-playbook check_and_patch.yml -e fix=true
#
- hosts: all
tasks:
@leucos
leucos / redis-sorted-set-tests.rb
Last active August 29, 2015 14:10
Unioning & sorting (redis + ruby)
#!/bin/env ruby
#
require 'hiredis'
require 'redis'
require 'benchmark'
require 'pp'
TOTAL_PAGES_PER_WINDOW = 15_000_000
CATEGORY_COUNT = 100
ARTICLES_COUNT = 150