Skip to content

Instantly share code, notes, and snippets.

Jesse Cotton JCotton1123

Block or report user

Report or block JCotton1123

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
JCotton1123 / main.go
Created Mar 4, 2020
CloudTrail Log Decompression Lambda
View main.go
package main
import (
JCotton1123 /
Created Feb 28, 2020
Netcat HTTP Server
cat >index.http <<EOF
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Server: netcat!
<!doctype html>
<html><body><h1>A webpage served by netcat</h1></body></html>
while true; do cat index.http | nc -l 8000; done
JCotton1123 /
Created Apr 30, 2019
Restore files from latest version in s3
if [ -z "$1" ]; then
echo "An input file is required"
echo "usage: $0 <input-file>"
exit 1
files=$(cat $1)
for f in $files; do
JCotton1123 /
Created Apr 1, 2019
Fluentd setup for Ubuntu
# Install dependencies
apt-get update; apt-get install -y build-essential ruby2.5-dev
gem install bundler --version 1.16.1
# Install fluentd
mkdir /opt/fluentd
pushd .; cd /opt/fluentd
cat <<EOD > Gemfile
source ""
JCotton1123 / Jenkinsfile
Last active Jan 21, 2020
Sample Jenkinsfile for Python project
View Jenkinsfile
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '10')) // Retain history on the last 10 builds
ansiColor('xterm') // Enable colors in terminal
timestamps() // Append timestamps to each line
timeout(time: 20, unit: 'MINUTES') // Set a timeout on the total execution time of the job
agent {
// Run this job within a Docker container built using
// contained within your projects repository. This image should include
JCotton1123 /
Created Mar 1, 2019
Primitive script for enumerating AWS services in use
while true; do
results=$(aws resourcegroupstaggingapi get-resources --tags-per-page 500 --pagination-token="$page_token")
more_services=$(echo "$results" | egrep -o 'arn:aws:([a-z]+):' | cut -d: -f 3 | sort | uniq)
services=$(echo -e "$services\n$more_services" | sort | uniq)
JCotton1123 / gist:5ee42a34d19cc7c50bb23eef5a06142c
Created Mar 4, 2017
Audit Chef client versions via knife
View gist:5ee42a34d19cc7c50bb23eef5a06142c
knife search node '*' -a chef_packages.chef.version | grep "chef_packages.chef.version" | cut -d" " -f4 | sort | uniq
JCotton1123 /
Created Feb 20, 2017
Setup Londiste2 on Ubuntu as of Feb 2017
add-apt-repository "deb trusty-pgdg main"
wget --quiet -O - | sudo apt-key add -
apt-get update
apt-get install postgresql-server-dev-9.4
apt-get install python-pip python-dev
pip install --upgrade pip
pip install psycopg2
apt-get install build-essential autoconf
View gist:f0fe955bcb242cf74e198bb0c4541555
# Database size
SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema ;
# Size of each non-primary index
SELECT database_name, table_name, index_name,
round(stat_value*@@innodb_page_size/1024/1024, 2) size_in_mb
JCotton1123 /
Created Jun 9, 2016
Export env variables for each AWS CloudFormation stack output
# This script will find all AWS CloudFormation stacks matching the supplied filter
# and export the outputs into environment variables.
# This script is assumed to be run on a host with an IAM profile matching the following:
# {
# "Version": "2012-10-17",
# "Statement": [
You can’t perform that action at this time.