Skip to content

Instantly share code, notes, and snippets.

@mclarke47
mclarke47 / delayed-etcd-reboot.sh
Created June 27, 2017 13:49
reboot kube-aws etcd nodes
#!/usr/bin/env bash
aws ec2 describe-instances --filter "Name=tag-key,Values=kube-aws:role" "Name=tag-value,Values=etcd" | jq -r '.Reservations[].Instances[].InstanceId' | while read object; do
echo "rebooting $object"
aws ec2 reboot-instances --instance-ids ${object}
sleep 300
done
@mclarke47
mclarke47 / rolling-controller-reboot.sh
Created June 27, 2017 13:09
kubernetes controller rolling reboot
#!/usr/bin/env bash
kubectl get nodes -o=json | jq -c -r '.items | map(select(.spec | has("taints"))) | map(select(.spec.taints[].value == "master")) | map(select(.spec.taints[].key == "node.alpha.kubernetes.io/role")) | .[]' | while read object; do
NODE_NAME=$(echo "$object" | jq -r .metadata.name)
INSTANCE_ID=$(echo "$object" | jq -r .spec.externalID)
echo "rebooting node=$NODE_NAME instance-id=$INSTANCE_ID"
kubectl drain ${NODE_NAME} --ignore-daemonsets --force
#!/bin/bash
find . -type d -maxdepth 1 \( ! -name . \) -exec bash -c "echo {}; cd {} && git $1" \;
source ~/.git_complete.sh
#Bash stuff
export PATH=$PATH:~/bin
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export PS1="[\d \t :\w ] $ "
alias ll="ls -l"
@mclarke47
mclarke47 / reddit unsave hack
Last active December 20, 2023 01:45
a complete hack to click the unsave buttons on all reddit posts on screen.
Doesn't seem to work anymore
$("a").filter(function(index){return $(this).text()==="unsave"}).click();
New
document.querySelectorAll("a").forEach(function(index,other){if(index.text==="unsave"){index.click();}});
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="Matula" version="124" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="14" />
<option name="EDITOR_FONT_NAME" value="Source Code Pro" />
<colors>
<option name="ADDED_LINES_COLOR" value="295622" />
<option name="ANNOTATIONS_COLOR" value="8b999f" />
<option name="CARET_COLOR" value="bbbbbb" />
<option name="CARET_ROW_COLOR" value="323232" />