Skip to content

Instantly share code, notes, and snippets.

@johnsondnz
johnsondnz / add_cloudflare_ips.sh
Created August 24, 2018 06:47 — forked from dduvnjak/add_cloudflare_ips.sh
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# iterate over the lines in the downloaded file
# make sure to set `--group-id` and `--port`; more details at http://docs.aws.amazon.com/cli/latest/reference/ec2/authorize-security-group-ingress.html
while read p; do aws ec2 authorize-security-group-ingress --group-id sg-e0000000 --protocol tcp --port 80 --cidr $p; done< ips-v4
@johnsondnz
johnsondnz / open-vm-tools-vmware-ubuntu-sharing.md
Created July 18, 2018 01:01 — forked from darrenpmeyer/open-vm-tools-vmware-ubuntu-sharing.md
open-vm-tools and VMWare Shared Folders for Ubuntu guests

(NB: adapted from this Ask Ubuntu thread -- tested to work with Ubuntu 16 LTS branches and Ubuntu 17.10)

Unlike using VMWare Tools to enable Linux guest capabilities, the open-vm-tools package doesn't auto-mount shared VMWare folders. This can be frustrating in various ways, but there's an easy fix.

TL;DR

Install open-vm-tools and run:

sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
@johnsondnz
johnsondnz / nginx.conf
Created November 5, 2017 03:42 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@johnsondnz
johnsondnz / iterable.py
Last active September 6, 2017 23:57 — forked from udondan/iterable.py
Ansible filter plugin for testing if variables are a list
from ansible import errors
from jinja2.filters import environmentfilter
class FilterModule(object):
def filters(self):
return {
'iterable': self.iterable
}
def iterable(*args):
if isinstance(args[1], list):