Skip to content

Instantly share code, notes, and snippets.

@duboisph
duboisph / gist:943cb4132866fd6e44cfeba72d81051f
Last active January 24, 2020 13:02
Remove K8s EBS snapshots
#!/usr/bin/env bash
# $1: Cluster Name
# $2: Date
# $3: --yes
SNAPS=$(aws ec2 describe-snapshots --filter "Name=tag:kubernetes.io/cluster/$1,Values=owned" --query "Snapshots[?StartTime<=\`$2\`].SnapshotId" --output text)
SNAPS_NUMBER=$(wc -w <<< "$SNAPS")
echo "Snapshots to delete: $SNAPS_NUMBER"
#!/usr/bin/env bash
VERSION='2.0'
DESC='Rotating incremental backup'
#set -o errtrace
set -o errexit
#-- VARS --#
@duboisph
duboisph / gist:86fd868ed1185c8d444d78e5655c275f
Last active January 30, 2019 17:08
Troubleshoot / restore Windows
sfc /scannow
dism /online /cleanup-image /checkhealth
dism /online /cleanup-image /startcomponentcleanup
dism /online /cleanup-image /restorehealth
Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
# Get list of all packages for all users
Get-AppxPackage -AllUsers | Select Name, PackageFullName, InstallLocation
# Remove packages / bloatware from all users
@duboisph
duboisph / gist:e150d3bd7b424d1ddb07fc9ebed26efa
Last active March 1, 2018 08:38
Reconfigure single node Elasticsearch replicas
#!/bin/bash
ES=$1
curl -s -XPUT ${ES}/_template/default -H 'Content-Type: application/json' -d '{ "order": 0, "template": "*", "settings": { "number_of_replicas": 0 }}'
echo
IFS=$'\n'
for line in $(curl -s ${ES}/_cat/indices?v 2> /dev/null); do
INDEX=$(echo $line | (awk '{print $3;}'))
curl -s -XPUT ${ES}/${INDEX}/_settings -H 'Content-Type: application/json' -d '{ "index" : { "number_of_replicas" : 0 } }'

Keybase proof

I hereby claim:

  • I am duboisph on github.
  • I am duboisph (https://keybase.io/duboisph) on keybase.
  • I have a public key ASAYRIH4pGTKCOxnPW0wwOdCwn26i4jpnf1RiI1Y4GUBnQo

To claim this, I am signing this object: