Skip to content

Instantly share code, notes, and snippets.

View dholdaway's full-sized avatar

Darren Holdaway dholdaway

View GitHub Profile
@dholdaway
dholdaway / instal_caffe_cpu.sh
Created March 23, 2018 15:02 — forked from rizky/instal_caffe_cpu.sh
Setup Caffe CPU Only in MacOS Sierra
#!/bin/sh
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install the experimental NVIDIA Mac drivers
# Download from http://www.nvidia.com/download/driverResults.aspx/103826/en-us
# Install cuDNN v5 for 8.0 RC or use the latest when it's available
# Register and download from https://developer.nvidia.com/rdp/cudnn-download
# or this path: https://developer.nvidia.com/rdp/assets/cudnn-8.0-osx-x64-v5.0-ga-tgz
# extract to the NVIDIA CUDA folder and perform necessary linking
@dholdaway
dholdaway / instal_caffe_cpu.sh
Created March 23, 2018 15:02 — forked from rizky/instal_caffe_cpu.sh
Setup Caffe CPU Only in MacOS Sierra
#!/bin/sh
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install the experimental NVIDIA Mac drivers
# Download from http://www.nvidia.com/download/driverResults.aspx/103826/en-us
# Install cuDNN v5 for 8.0 RC or use the latest when it's available
# Register and download from https://developer.nvidia.com/rdp/cudnn-download
# or this path: https://developer.nvidia.com/rdp/assets/cudnn-8.0-osx-x64-v5.0-ga-tgz
# extract to the NVIDIA CUDA folder and perform necessary linking
@dholdaway
dholdaway / lock_down_public_s3_buckets.md
Created April 7, 2018 00:03 — forked from apolloclark/lock_down_public_s3_buckets.md
Bash one-liner to find public facing AWS S3 buckets, and make them private

Command

aws s3api list-buckets --query 'Buckets[*].[Name]' --output text | xargs -I {} bash -c 'if [[ $(aws s3api get-bucket-acl --bucket {} --query '"'"'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/AllUsers` && Permission==`READ`]'"'"' --output text) ]]; then aws s3api put-bucket-acl --acl "private" --bucket {} ; fi'



1. List all of the user's buckets, and output the name, as text.

@dholdaway
dholdaway / postgres_queries_and_commands.sql
Created February 3, 2017 10:02 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@dholdaway
dholdaway / build-tag-push.py
Created August 1, 2018 10:25 — forked from peatiscoding/build-tag-push.py
a script to convert your docker-compose.yml (version 2) with build node to image node; this script required DOCKERHUB_USER environment available.
#!/usr/bin/python
import os
import subprocess
import time
import yaml
import re
user_name = os.environ.get("DOCKERHUB_USER")
@dholdaway
dholdaway / docker-swarm-ports.md
Created August 9, 2018 13:51 — forked from BretFisher/docker-swarm-ports.md
Docker Swarm Port Requirements, both Swarm Mode 1.12+ and Swarm Classic, plus AWS Security Group Style Tables

Docker Swarm Mode Ports

Starting with 1.12 in July 2016, Docker Swarm Mode is a built-in solution with built-in key/value store. Easier to get started, and fewer ports to configure.

Inbound Traffic for Swarm Management

  • TCP port 2377 for cluster management & raft sync communications
  • TCP and UDP port 7946 for "control plane" gossip discovery communication between all nodes
  • UDP port 4789 for "data plane" VXLAN overlay network traffic
  • IP Protocol 50 (ESP) if you plan on using overlay network with the encryption option

AWS Security Group Example

@dholdaway
dholdaway / ssh_securitygroup.tf
Created August 30, 2018 20:50
add my ip address to AWS security group
provider "aws" {
region = "eu-west-1"
}
data "http" "ip" {
url = "http://icanhazip.com"
}
resource "aws_security_group" "ssh" {
name = "ssh"
@dholdaway
dholdaway / install_container_service.sh
Created March 21, 2019 00:40 — forked from carlosedp/install_container_service.sh
Install Container services (Docker/Kubernetes) on Debian/Ubuntu
#!/bin/bash
echo "Container Linux installation script"
echo "This will install:"
echo " - Docker Community Edition"
echo " - Docker Compose"
echo " - Kubernetes: kubeadm, kubelet and kubectl"
echo ""
set -xeo pipefail
@dholdaway
dholdaway / gist:8aacb454e6229defa8d6b7cd1e71d04a
Created March 21, 2019 00:41 — forked from carlosedp/gist:4df3cd58a489a3c4022f97a474439b90
Rock64 Install (Adjust IPs/Hostnames/DNS to your deployment)
# Rock64 Install (Adjust IPs/Hostnames/DNS to your deployment)
Disable NetworkManager and DHCP Client
sudo systemctl stop dhcpcd
sudo systemctl stop NetworkManager
sudo systemctl disable dhcpcd
sudo systemctl disable NetworkManager
sudo systemctl daemon-reload
@dholdaway
dholdaway / nginx.conf
Created July 18, 2019 19:45 — forked from shortjared/nginx.conf
AWS API Gateway Nginx Reverse Proxy
# NOTE
#
#
# Use sed on the instance up to replace the INSTANCE_ID and DNS_RESOLVER with the following commands
#
####################################################################################################
# Fetch the private IP for resolving DNS dynamically in nginx
# We also need to escape the `.` from it for usage in later sed
#
# DNS_RESOLVER=`grep nameserver /etc/resolv.conf | cut -d " " -f2 | sed 's/\./\\./g'`