This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export AWS_PROFILE=xxxx | |
aws cloudformation list-stacks --stack-status-filter UPDATE_COMPLETE --query StackSummaries[*].StackName --output text | xargs -n 1 aws cloudformation update-termination-protection --enable-termination-protection --stack-name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!./env/bin/python | |
import boto3 | |
import sys | |
def format_filter(fils=None, tags=None): | |
f = [] | |
if fils is not None: | |
for k, v in fils.items(): | |
f.append({'Name': k, 'Values': [v]}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!./env/bin/python | |
import base64 | |
import sys | |
def encode_user_data(lines): | |
""" | |
Input is an array of lines that together make a script. | |
Output is a base64 encoded block suitable for the userdata parameter | |
of an instance config. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# When sourced, this script will export the AWS_ACCESS_KEY_ID and | |
# AWS_SECRET_ACCESS_KEY credentials from the a specific profile in | |
# ~/.aws/credentials. | |
# | |
# Usage: | |
# | |
# export-aws-credentials [PROFILE] | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned long hTime = 0; // integer for storing high time | |
unsigned long lTime = 0; // integer for storing low time | |
const int window = 4; // sliding window size | |
const int shift = 3; // reject pulses if width < sum * (window / 2^shift) or 1/2 of mean pulse | |
unsigned long highFilter[window]; | |
int highIndex = 0; | |
unsigned long lowFilter[window]; | |
int lowIndex = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from xml.etree import ElementTree as ET | |
import sys | |
def compareString(a,b): | |
aLower = a.lower() | |
bLower = b.lower() | |
order = 0 | |
if aLower > bLower: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Boolean failed = manager.getResult() != "SUCCESS"; | |
def file = new File(manager.build.getWorkspace().getRemote() + '/FailedBuildsCount.txt'); | |
def count = 0; | |
if (failed) { | |
if (!file.exists()) { | |
file.createNewFile(); | |
} else { | |
FileReader reader = new FileReader(file); | |
BufferedReader bufferedReader = new BufferedReader(reader); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Command-line: | |
# Dump everything | |
# ./portstat.py | |
# | |
# Dump specific value | |
# ./portstat.py state-time-wait | |
# | |
# UserParameter=oth.port[*],/etc/zabbix/scripts/portstat.py '$1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/rvm/rubies/ruby-1.9.3-p547/bin/ruby | |
# Guy Carpenter - 11 Jul 2014 | |
require 'rubygems' | |
require 'hipchat' | |
# API: https://github.com/hipchat/hipchat-rb | |
# https://www.hipchat.com/docs/api/method/rooms/message | |
to = ARGV[0] | |
subject = ARGV[1] # <Host>:(PROBLEM|OK):(Warning|Error|):<Name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wiringpi | |
import time | |
# 1M external pull-up resistor | |
# 1) set pin low and to output to discharge | |
# 2) make the pin an input without the internal pull-up on | |
# 3) read input and see how long it takes to go high | |
# ref: https://github.com/WiringPi/WiringPi-Python | |
# pins: https://projects.drogon.net/raspberry-pi/wiringpi/pins/ |
NewerOlder