Skip to content

Instantly share code, notes, and snippets.

@andywirv
andywirv / leaders.sh
Created January 12, 2018 11:18
Consul leaders
fss_sandbox=consul.sandbox.fss
fss_production=consul.production.fss
apps=consul-apps.hashicorp
url=domain/v1/operator/raft/configuration?stale=true
declare -a consuls=($fss_sandbox $fss_production $apps)
for consul in "${consuls[@]}"; do
printf "%s Leader is: " "$consul";
curl -s "http://$consul.$url\\n" |jq '.Servers[] | select(.Leader==true) | .Address'
@andywirv
andywirv / akamai.tf
Last active January 25, 2018 13:55
Add an AWS Security group for Akamai Siteshield
locals {
"akamai_siteshield_ranges" = [
"11.22.33.41/24",
"11.22.33.42/24",
"11.22.33.45/24"
]
}
resource "aws_security_group" "akamai_siteshield_ranges" {
name = "aws-europe-s1486.akamaiedge.ne"
@andywirv
andywirv / zk.sh
Last active January 29, 2018 14:06
Run zk cli on DC/OS instance
export JAVA_HOME=/opt/mesosphere/
cd /opt/mesosphere/bin/
./zkCli.sh -server leader.mesos:2181
@andywirv
andywirv / rollme.scpt
Last active April 6, 2018 14:55
Spotify Rick Roll
on ApplicationIsRunning(appName)
tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)
return appNameIsRunning
end ApplicationIsRunning
repeat
if ApplicationIsRunning("Spotify") then
tell application "Spotify"
try
if player state is playing and player position is greater than 30 and track is not "spotify:track:4uLU6hMCjMI75M1A2tKUQC" then