Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View shanedroid's full-sized avatar

Shane Kirk shanedroid

View GitHub Profile
@shanedroid
shanedroid / .htaccess
Created March 4, 2014 19:52
.htaccess TEMPLATE
/* HTACCESS TEMPLATE - USE FOR STUFFS */
### Disable Directory Lsiting ###
#Options All -Indexes
### Domain redirects ###
#RewriteEngine on
#RewriteCond %{HTTP_HOST} ^mysite.com
#RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
@shanedroid
shanedroid / route-53-user-policy.json
Last active October 12, 2016 02:30
IAM policy to allow for updating DNS RECS in Route 53
{
"Version": "2012-10-17",
"Statement":[
{
"Action":[
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets",
"route53:GetChange"
],
@shanedroid
shanedroid / docker.md
Last active December 19, 2016 18:27
Docker Cheat Sheet
Remove all Docker Containers
docker rm $(docker ps -a -q)
Remove all Docker Images
docker rmi $(docker images -a -q)
@shanedroid
shanedroid / halp.MD
Last active February 16, 2023 10:43
Add GitHub SSL Certificate to Jenkins Keystore

I needed to do this as a workaround while running Jenkins via HTTPS, for some reason I was unable to get any GitHub Webhooks to work and would see the following errs in Jenkins log:

jenkins github webhook javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  1. Fetch the certificate from local GitHub:
openssl s_client -connect www.github.com:443 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/github_public.crt
@shanedroid
shanedroid / nuke_sg.py
Created May 31, 2017 17:07
Nuke any Unused EC2 Security Groups
#!/usr/bin/env python
## -*- coding: utf-8 -*-
"""Nuke any Unused EC2 Security Groups"""
import argparse, boto3, pprint
from botocore.exceptions import ClientError
from itertools import chain
pprint = pprint.PrettyPrinter(indent=4).pprint
def parse_args():
@shanedroid
shanedroid / find_iam_user.py
Created May 31, 2017 17:12
Find the IAM username belonging to a given Access key
#!/usr/bin/env python
## -*- coding: utf-8 -*-
"""Find the IAM username belonging to a given Access key"""
# Taken from David Brodsky's - find_iam_user script
# https://gist.github.com/OnlyInAmerica/9964456
from optparse import OptionParser
import boto.iam, os
def build_opt_parser():
parser = OptionParser(usage="Usage: %prog [options]")
@shanedroid
shanedroid / find_sg.py
Created May 31, 2017 17:14
Find which Security Groups an IP address belongs to (ipv4)
#!/usr/bin/env python
## -*- coding: utf-8 -*-
"""Find which Security Groups an IP address belongs to"""
#
import argparse, boto3, pprint, os
pprint = pprint.PrettyPrinter(indent=4).pprint
def parse_args():
parser = argparse.ArgumentParser(description='Find which Security Groups an IP address belongs to')
@shanedroid
shanedroid / jenkins_plugins.yml
Last active September 18, 2017 14:31
Tasks to be used in a wrapper role in conjunction geerlingguy.jenkins to handle Jenkins Plugins
---
# Setting plugins using our own role to be able to pin exact versions
# https://github.com/geerlingguy/ansible-role-jenkins/issues/122
# https://github.com/geerlingguy/ansible-role-jenkins/issues/85
# On initial provisioning run do not set {{ jenkins_master__github_token }}
# After githuboath plugin is configured on a Jenkins Master, the a
# Github personal token must be used for configuring Jenkins
- name: set options for jenkins plugins with initial admin password (default security)
set_fact:
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
@shanedroid
shanedroid / git-log-fetch-pull-requests.bash
Created August 10, 2018 05:37
Pull all pull requests for a known date range
git fetch -p && git checkout branch && git pull origin branch
git log --merges --grep="Merge pull request #" --pretty=format:"%ad - %an: %s" --after="YYYY-MM-DD" --until="YYYY-MM-DD" > all_pull_requests_gitlog__YYYYMMDD-YYYYMMDD.log