Skip to content

Instantly share code, notes, and snippets.

View sidcpatel's full-sized avatar

Siddharth Patel sidcpatel

  • San Diego, CA
View GitHub Profile
@sidcpatel
sidcpatel / gen_cf_cidr.rb
Last active May 1, 2017 18:42
Generate nginx config file to skip cloudfront cidr addresses.
#!/usr/bin/env ruby
require 'net/http'
require 'json'
url = URI.parse('https://ip-ranges.amazonaws.com/ip-ranges.json')
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port, use_ssl: true) do |http|
http.request(req)
end
@sidcpatel
sidcpatel / gen_cf_cidr.py
Last active November 21, 2017 03:38 — forked from pahud/gen_cf_cidr.py
generate AWS CloudFront IP/CIDR range
#!/usr/bin/env python
import requests, json, datetime
d = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json').text
l = json.loads(d)
print "# Amazon CloudFront IP Ranges"
print "# Generated at " + str(datetime.datetime.now())
for ip_range in [x['ip_prefix'] for x in l['prefixes'] if x['service']=='CLOUDFRONT' ]:
print "set_real_ip_from " + ip_range + ";"
@sidcpatel
sidcpatel / Dockerfile
Created May 13, 2016 00:19 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world