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
require 'json' | |
require 'net/http' | |
SCHEDULER.every '30s', :first_in => 5 do |job| | |
resp = Net::HTTP.get_response(URI.parse('http://cdnedge.bbc.co.uk/feeds/hi/english/static/cricket/statistics/scorecards/2013/07/87719/live_scorecard.json')) | |
data = resp.body | |
result = JSON.parse(data) | |
text = "<p>" + result["scorecard"]["teamASummary"] + "</p><p>" + result["scorecard"]["teamBSummary"] + "</p>" |
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
aws ec2 describe-images --filters Name=image-type,Values=kernel --filters Name=manifest-location,Values='*pv-grub-hd0_*x86_64*' --owners amazon |
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
aws ec2 describe-instances --filters Name=tag:aws:cloudformation:stack-name,Values=${STACKNAME} --output text --query 'Reservations[*].Instances[*].PrivateIpAddress' |
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
# Docker image to use with Vagrant | |
# Aims to be as similar to normal Vagrant usage as possible | |
# Adds Puppet, SSH daemon | |
FROM centos | |
MAINTAINER Sam Bashton <[email protected]> | |
RUN yum -y install openssh-server | |
RUN yum -y install MAKEDEV | |
# Workaround needed for bad libselinux-ruby deps | |
RUN yum -y downgrade libselinux-2.0.94-5.3.el6_4.1 libselinux-utils |
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
#!/bin/bash -e | |
# Script to build a base CentOS 7 Pre-release docker image | |
# Tested under CentOS 6 | |
BUILDROOT="/centos7" | |
if [ $(id -u) -ne 0 ]; then | |
echo "Must be run as root" | |
exit 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
#!/bin/bash | |
if [ -n $1 ]; then | |
echo "Usage: $0 <username>" | |
fi | |
for mfaserial in $(aws iam list-mfa-devices --user-name $user --query MFADevices[].SerialNumber --output text); do | |
aws iam deactivate-mfa-device --serial-number $mfaserial --user-name $user | |
aws iam delete-virtual-mfa-device --serial-number $mfaserial | |
done |
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
#!/bin/bash | |
if [ -n $1 ]; then | |
echo "Usage: $0 <username>" | |
fi | |
user=$1 | |
# First, find which groups the user is in and remove them from there | |
for group in $(aws iam list-groups-for-user --user-name $user --query Groups[].GroupName --output text); do | |
aws iam remove-user-from-group --user-name $user --group-name $group |
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
user=foo | |
for key in $(aws iam list-access-keys --user-name $foo --query 'AccessKeyMetadata[].AccessKeyId' --output text); do | |
aws iam get-access-key-last-used --access-key-id $key | |
done |
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
#!/bin/bash | |
for user in $(aws iam list-users --query 'Users[].UserName' --output text); do | |
for key in $(aws iam list-access-keys --user-name $user --query 'AccessKeyMetadata[].AccessKeyId' --output text); do | |
aws iam get-access-key-last-used --access-key-id $key --query '[UserName,AccessKeyLastUsed.LastUsedDate]' --output text | |
done | |
done |
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
for detectorid in $(aws guardduty list-detectors --query DetectorIds[] --output text); do | |
aws guardduty get-findings --detector-id $detectorid \ | |
--finding-ids $(aws guardduty list-findings --detector-id $detectorid --query FindingIds --output text) \ | |
--query 'Findings[*].[Resource.InstanceDetails.InstanceId,Type,Service.Count]' --output text | |
done |
OlderNewer