Skip to content

Instantly share code, notes, and snippets.

Avatar

Shane Kirk shanedroid

View GitHub Profile
@shanedroid
shanedroid / git-log-fetch-pull-requests.bash
Created Aug 10, 2018
Pull all pull requests for a known date range
View git-log-fetch-pull-requests.bash
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
View human_log.py
# 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 / jenkins_plugins.yml
Last active Sep 18, 2017
Tasks to be used in a wrapper role in conjunction geerlingguy.jenkins to handle Jenkins Plugins
View jenkins_plugins.yml
---
# 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:
@shanedroid
shanedroid / find_sg.py
Created May 31, 2017
Find which Security Groups an IP address belongs to (ipv4)
View find_sg.py
#!/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 / find_iam_user.py
Created May 31, 2017
Find the IAM username belonging to a given Access key
View find_iam_user.py
#!/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 / nuke_sg.py
Created May 31, 2017
Nuke any Unused EC2 Security Groups
View nuke_sg.py
#!/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 / halp.MD
Last active May 22, 2020
Add GitHub SSL Certificate to Jenkins Keystore
View halp.MD

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 / docker.md
Last active Dec 19, 2016
Docker Cheat Sheet
View docker.md
Remove all Docker Containers
docker rm $(docker ps -a -q)
Remove all Docker Images
docker rmi $(docker images -a -q)
@shanedroid
shanedroid / route-53-user-policy.json
Last active Oct 12, 2016
IAM policy to allow for updating DNS RECS in Route 53
View route-53-user-policy.json
{
"Version": "2012-10-17",
"Statement":[
{
"Action":[
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets",
"route53:GetChange"
],
@shanedroid
shanedroid / .htaccess
Created Mar 4, 2014
.htaccess TEMPLATE
View .htaccess
/* 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]