Skip to content

Instantly share code, notes, and snippets.

View andy-b-84's full-sized avatar

Patrick Laxton andy-b-84

  • Peaks
  • LYON (France)
View GitHub Profile
@andy-b-84
andy-b-84 / delete_all_object_versions.sh
Last active May 23, 2023 01:20
[AWS][S3] permanently delete every objects from a versioned bucket, typically before destroying the bucket, launching headless commands (make that CPU burn, Nero)
#!/bin/bash
bucket=$1
profile=$2
region=$3
set -e
echo "Removing all versions from $bucket"
ansible pattern* -i inventories/path --vault-password-file=vault.key -m file -a "path=/path/to/file state=absent" -b
```
$ ansible --help
Usage: ansible <host-pattern> [options]
Options:
-a MODULE_ARGS, --args=MODULE_ARGS
module arguments
...
04b4b7772d76dd9d47443bdad5e506be4d4e9430237ad153ebeead825785bcef80864d4c357c1cd6d66a0c541f9dc232b1007081e2f12d8f5df1191f89c05ec7de
#!/usr/bin/env python
#elb.detail.py
# don't forget to run aws configure before running that script
import boto3, pprint
elbclient = boto3.client('elb')
response = elbclient.describe_load_balancers(
#!/usr/bin/env python
#ec2.list.instances.py
# don't forget to run aws configure before running that script
import boto3
ec2client = boto3.client('ec2')
ec2resource = boto3.resource('ec2')
import string
from random import sample, choice
chars = string.letters + string.digits
length = 10
// chars = string.letters + string.digits + string.punctuation
chars = string.letters + string.digits + '!#$%&\()*+,./<=>?'
''.join(choice(chars) for _ in range(length))
India Foxtrot Yankee Oscar Uniform Charlie Alpha
November Romeo Echo Alpha Delta Tango Hotel
India Sierra India Mike November Echo Victor Echo
Romeo Golf Oscar November November Alpha
Golf India Victor Echo Yankee Oscar Uniform
Uniform Papa November Echo Victor Echo Romeo
Golf Oscar November November Alpha Lima Echo
Tango Yankee Oscar Uniform Delta Oscar
Whiskey November November Echo Victor Echo
Romeo Golf Oscar November November Alpha
@andy-b-84
andy-b-84 / .gitconfig
Created May 26, 2016 08:38
Usual .gitconfig file, with git-flow aliases, notably some which I use to make the history a bit more readable after a "git flow feature finish" or a "git flow hotfix finish" (I hate the way git-flow merge everything back into develop, makes everything impossible to read afterwards)
[core]
excludesfile = /Users/andy_b_84/.gitignore_global
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[user]
name = Patrick Laxton
@andy-b-84
andy-b-84 / Vagrantfile
Created August 31, 2014 13:20
Vagrantfile compatible with andy_b_84/debian-squeeze64-lamp and vagrant share
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "andy_b_84/debian-squeeze64-lamp"
config.vm.network "forwarded_port", guest: 80, host: 8080
end