Skip to content

Instantly share code, notes, and snippets.

View joshlove's full-sized avatar

Josh Love joshlove

  • AWS
  • Pittsburgh PA
View GitHub Profile
@joshlove
joshlove / ssl_expiry.sh
Created January 24, 2018 19:15
ssl_expiry
#!/bin/bash
ERR=0
function ssl_check(){
local TARGET=$1;
local DAYS=7;
echo "checking if $TARGET expires in less than $DAYS days";
expirationdate=$(date -d "$(: | openssl s_client -connect $TARGET:443 -servername $TARGET 2>/dev/null \
| openssl x509 -text \
| grep 'Not After' \
@joshlove
joshlove / qualys_domain_checker.sh
Created January 24, 2018 19:11
Checks qualy's rating
#!/usr/bin/env bash +x
#clone the repo if it's not there.
if [ ! -d ssllabs-scan ]; then
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
git clone git://github.com/ssllabs/ssllabs-scan.git
fi
#jump into it
cd ssllabs-scan
@joshlove
joshlove / is_first_char_upper.rb
Created January 22, 2018 23:36
check if first char is upper
class String
def is_first_char_upper?
self[0] == self[0].upcase
end
end
@joshlove
joshlove / keeb.ino
Created May 29, 2017 15:43
keyboard footswitch
#include <Bounce.h>
const int yPin = 0;
const int hPin = 1;
const int nPin = 2;
Bounce yB = Bounce(yPin, 10);
Bounce hB = Bounce(hPin, 10);
Bounce nB = Bounce(nPin, 10);
void setup() {
pinMode(yPin, INPUT_PULLUP);
@joshlove
joshlove / aws_creds_file.rb
Created May 10, 2017 01:23
aws_creds_file.rb
require 'inifile'
unless @key_id
aws_credentials=IniFile.load(ENV['HOME']+'/.aws/credentials')
puts "Profiles in ~/.aws/credentials:"
aws_credentials.sections.each do |section|
section_index = aws_credentials.sections.index(section)
puts section_index.to_s + ": " + section
end
puts "Enter the number for the corresponding AWS profile: "
#!/bin/bash
terraforming help | grep terraforming | grep -v help | awk '{print "terraforming", $2, "--profile", "default", ">", $2".tf";}' | bash
@joshlove
joshlove / gist:d7e9abb0881971e815651c95d52bf4f3
Created February 6, 2017 00:58
Import EC2 instances into terraform
#!/usr/bin/env bash
IFS=$'\n'
for each in $(aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,Tags[?Key==`Name`].Value | [0]]' --output text);
do
instance=$(echo $each | cut -d$'\t' -f1)
name=$(echo $each | cut -d$'\t' -f2)
terraform import aws_instance.${name} ${instance}
done
@joshlove
joshlove / list_aws_AZs.sh
Created January 6, 2017 15:31
lookup all availability zones for all regions
for i in `aws ec2 describe-regions | jq -r '.Regions[].RegionName'` ; do
aws ec2 describe-availability-zones --region $i
done
#from $JENKINS_HOME/jobs
for i in $(ls -1 *JobGlob*/config.xml); do
prefix=$(dirname $i)
fn=$(basename $i)
cp $i /tmp/jenkins_build_issues/${prefix}_${fn}
done
@joshlove
joshlove / gist:be0c9586029e0a63f103f0bebf71a9fe
Created September 19, 2016 11:15
wget - scrape entire site
wget --mirror -p --convert-links -P . http://webpage.url