Skip to content

Instantly share code, notes, and snippets.

View jacarandang's full-sized avatar

Jym Paul A. Carandang jacarandang

View GitHub Profile
@jacarandang
jacarandang / squid-setup.sh
Created July 15, 2015 23:08
Setup squid3 on an ubuntu machine
#updating and upgrading
sudo apt-get update
sudo apt-get upgrade
#installing squid3
sudo apt-get install squid3
#installing rvm and rubies
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable --ruby
@jacarandang
jacarandang / rewrite.rb
Created July 15, 2015 05:38
Rewrite.rb for squid3
#!/usr/bin/env ruby
# url rewriter for rubygems squid proxy
STDOUT.sync = true
while line = gets
url = line.split(' ')[0]
# Cargo-culted this conditional, not sure if it is necessary
response = if url
@jacarandang
jacarandang / gist:076ab1989f9c5723fa4e
Created July 15, 2015 03:02
Squid3 Configuration
##########################################################################
#
# Proof-of-concept squid proxy settings for proxying http://rubygems.org/
# Caches everything so is resilient to network outage or upstream outage.
# Works with bundler, gives a significant speed up when cache is warm (100%+)
#
##########################################################################
# Disable default patterns that prevent caching of query params
# refresh_pattern -i (/cgi-bin/|\?) 0 0% 0