Skip to content

Instantly share code, notes, and snippets.

View JCotton1123's full-sized avatar

Jesse Cotton JCotton1123

View GitHub Profile
@JCotton1123
JCotton1123 / chef-repo-pin-versions.sh
Last active October 13, 2015 05:23
Numerous Chef related cleanup snippets
for cookbook in $(ls); do
knife cookbook metadata from file $cookbook/metadata.rb
done
for cookbook in $(ls); do
echo "Processing cookbook $cookbook"
if [ ! -d $cookbook ]; then
continue
fi
deps=$(cat $cookbook/metadata.json | python -c 'import sys, json; print "\n".join(json.load(sys.stdin)["dependencies"].keys())')
@JCotton1123
JCotton1123 / .kitchen.yml
Created October 9, 2015 21:49
Kitchen network sample
---
driver:
name: vagrant
network:
- ["public_network", {"bridge": "en0: Wi-Fi (AirPort)"}]
@JCotton1123
JCotton1123 / rds-import.sh
Created September 23, 2015 03:44
Amazon RDS migration script
#!/bin/bash
TMP_DIR="/mnt/data/tmp"
LOCAL_HOST="localhost"
LOCAL_PASS=""
FOREIGN_HOST=".us-east-1.rds.amazonaws.com"
FOREIGN_PASS=""
@JCotton1123
JCotton1123 / ldap_search_time.rb
Created August 26, 2015 04:06
ScoutApp LDAP Search Time plugin
class LDAPSearchTime < Scout::Plugin
OPTIONS=<<-EOS
uri:
default: ldapi:///
name: URI
authmech:
default: EXTERNAL
name: Auth Mechanism
username:
name: Username
@JCotton1123
JCotton1123 / simplerelay.py
Last active September 2, 2022 00:11
Start of simple SMTP relay service in Python
#!/usr/bin/env python
import os
import re
import daemon
import asyncore
import smtpd
class SimpleRelayService(smtpd.PureProxy):
"""Handles processing mail for relay"""
@JCotton1123
JCotton1123 / gh-contribs.csv
Last active April 13, 2016 04:25
Github contributions
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
https://github.com/Bitlancer/puppet-cloudfuse
https://github.com/Bitlancer/puppet-motd
https://github.com/Bitlancer/puppet-openldap
https://github.com/Bitlancer/puppet-sssd
https://github.com/Bitlancer/puppet-tomcat
https://github.com/Bitlancer/puppetlabs-apache
https://github.com/Bitlancer/strings-dashboard
https://github.com/Bitlancer/strings-datasync
https://github.com/Bitlancer/strings-deploy-toolkit
https://github.com/Bitlancer/strings-documentation
@JCotton1123
JCotton1123 / gist:023882559360f549ee11
Created May 19, 2015 23:34
github-contributor-builder
#!/bin/bash
data_directory="/var/www/html/"
page_size=1000
yesterday=$(date +%Y%m%d -d "yesterday")
count_query="
SELECT count(*) FROM (
SELECT actor.login,repo.name
FROM [githubarchive:day.events_${yesterday}]
@JCotton1123
JCotton1123 / php-audit.md
Last active August 29, 2015 14:15
PHP Audit

PHP Audit

  1. Command Injection, File Inclusion, Directory Traversal

Check use of:

  • shell_exec
  • exec
  • backtick (`)
  • system
@JCotton1123
JCotton1123 / openvpn-windows-installer.au3
Created November 6, 2014 04:42
Windows OpenVPN installer
; Automated installer for OpenVPN
; The MIT License (MIT)
;
; Copyright (c) 2014 Jesse Cotton <jcotton1123@gmail.com>
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#!/bin/bash
CMD=$(basename $0)
STATE=$1
NAME=$2
HOSTS=$3
LICENSE_PATH=$4
PASSWORD=$5
DATA_PATH=$6
RESTART_POLICY=$7