Skip to content

Instantly share code, notes, and snippets.

Seth Ryder sethryder

Block or report user

Report or block sethryder

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sethryder
sethryder / snapshot_handler.py
Created May 15, 2019
ebs snapshot handler lambda
View snapshot_handler.py
import boto3
import datetime
from dateutil.relativedelta import relativedelta
import logging
import sys
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def get_dates_to_keep(days_to_keep, weeks_to_keep, months_to_keep):
View ebs_last_attached_policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:DescribeVolumes",
"ec2:DescribeTags",
"ec2:CreateTags"
View gist:f085b7b783ee677dffe0ff8d4dce3cce
A0mQMAAgpYTqkgjRJqUkZgl1iwS7RKhfIoSGSeqYIstU6ZlKTJPgmgLbRNQ3EhoHiXNQaZ1SondKSTqolFoo0UMFNZFEuajQRiF9hIqRkHQSUitFCJpJSjehaieUnxBDFbVUFZ6ipgJXVdJWpYTyVSmpsyKktUoJeUsi3SURe6m/IjJYQQ6DFpP0WJLJKnVZajOpPgsxWqTTolYrJXhNopqt5DYpdgt+Iw1XquMiBJYjnquYTlxXle2q6rtSjJeQ86povQj2S6g9GZhvKFCF5BiYIZGsw0oMzGnnSCrGJpTJYu6ivUnuULWBOe0cScXYhDJZzCkNlBiYO0B1tVVz2jmSirEJZbKYSe+fQMk0GJg7QHW1S3PaOZKKsQllsphhQpMsbWBOO0dSMTahTBaLufoI6SDgE0oyXMamyXxWG5hvKFCF5BiYIZGsw0oMzIuGiHSRuDRXKRQ9L2liYO4A1dUuLRZzF+0G5iqFouclTQzMHaC62qX5yHO1mUGi2vG1WMykdwNzlULR85ImBuYOUF3t0nzkuVpZV2YGiWrH13zkudrMIFHt+Fos5pQGSgzMVQpFz0uaGJjhBpKb5bnazCBR7fiajzxXmxkkqh1RzB2gutqlxWIxE5hvDSTKmxwD89lhlUPEmMJkVj8RGjgntLG3YDFr+s7QwKzTIMfAnEBDG5h1GsT81vVrMZ9PTaChDcw6DWJ+6/q1mPd/NzDrNIj5revXYrGY1ZUTEiC5Dcx/p7lazQ2FK7jaWJ1Y0WLeJhpKngbm4RQSWEkTAzMLlGNgRsJ6ziRrIHlaNaPXv6LfWi7N2nzEwDwjW48Pl2bUcVsLUF1azOj1r2G6KHFpMZewUn4TuhuYuVdX0neJYwZpj5o9k7aYlX0EqnlleRqYozQI54Q2NtUW8xiqFAYxMEdpEM4JbWyaLGZt/70MzFEahHNCG5tei8WMDmfvSgzMOATeUDINBuZhuigxMDY5qliYFJNxL4P6glsXLgVF6wqDgrHXUcXC4FJPA5TBBfd9
@sethryder
sethryder / yoast_redirect_fixer.php
Last active Oct 31, 2018
update redirects in yoast when changing from date based permalinks to just post name
View yoast_redirect_fixer.php
<?php
$option_value_export_plain = file_get_contents('export_plain.txt');
$option_value_base = file_get_contents('base.txt');
$export_plain = unserialize($option_value_export_plain);
$base = unserialize($option_value_base);
$new_export_plain = [];
@sethryder
sethryder / cloudfront_ips_lambda.py
Last active Jul 30, 2018
simple lambda for storing cloudfront ips in parameter store for use in other places (such as nginx for where to trust X-Forwarded-For headers)
View cloudfront_ips_lambda.py
from botocore.vendored import requests
import json
import boto3
def get_cloudfront_ips():
ip_list = ''
d = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json').text
l = json.loads(d)
for ip_range in [x['ip_prefix'] for x in l['prefixes'] if x['service']=='CLOUDFRONT' ]:
ip_list += ip_range + ','
@sethryder
sethryder / blackbox.yml
Last active Oct 29, 2019
monitor multiple blackbox modules with a single job
View blackbox.yml
modules:
https_2xx:
prober: http
timeout: 5s
http:
method: GET
no_follow_redirects: false
fail_if_ssl: false
fail_if_not_ssl: true
preferred_ip_protocol: "ipv4"
View gist:5e40c4e9e406927afc494be7d9473884
### Keybase proof
I hereby claim:
* I am sethryder on github.
* I am sethryder (https://keybase.io/sethryder) on keybase.
* I have a public key whose fingerprint is F4E2 F6DC 5EB7 01DF B577 7628 B4F6 78C6 49B5 866D
To claim this, I am signing this object:
View cachet_lambda.py
import requests
import time
import json
checks = {}
api_key = ''
api_endpoint = ''
checks['google'] = {'metric_id': 1, 'url': 'http://www.google.com'}
@sethryder
sethryder / aws-generate-ssh-config.php
Created Apr 12, 2016
a quickly hacked together script to generate a .ssh/config from aws instances
View aws-generate-ssh-config.php
<?php
$ssh_instances = [];
$ssh_user = 'root';
require 'vendor/autoload.php';
$ec2 = new Aws\Ec2\Ec2Client([
'version' => 'latest',
'region' => 'us-east-1'
]);
View epel.repo.j2
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[epel-debuginfo]
You can’t perform that action at this time.