Skip to content

Instantly share code, notes, and snippets.

View floodedcodeboy's full-sized avatar

Jacob Gabriel floodedcodeboy

  • London, United Kingdom
  • 00:28 (UTC +01:00)
View GitHub Profile
@floodedcodeboy
floodedcodeboy / setup remote key
Created May 20, 2013 10:46
Nice little bash function for adding ssh keys to remote hosts. Place this in your .profile file or where ever you're comfortable having this.
function setup_remote_key() {
cat ~/.ssh/id_rsa.pub | ssh $@ "cat - >> ~/.ssh/authorized_keys"
}
@floodedcodeboy
floodedcodeboy / packer-bootstrap.sh
Last active March 23, 2024 05:54 — forked from bkw/preseed.cfg
packer.io config files to go from pristine vanilla ubuntu 12.04 LTS to a docker.io and chef-enabled vagrant box The resulting image is still a bit large and doesn't yet follow all the vagrant conventions, but it's a start.
#!/bin/sh
## install software for the base box to come packaged with - these will always be updated with chef/pupput
apt-get -y update && apt-get -y upgrade
apt-get install -y linux-image-generic-lts-raring linux-headers-generic-lts-raring build-essential dkms rubygems lxc-docker zlib1g-dev libssl-dev libreadline6-dev libyaml-dev ruby1.8 curl wget git-core gcc g++ make autoconf python-software-properties screen puppet puppetmaster openssl-server
sudo /usr/bin/gem install chef ruby-shadow --no-ri --no-rdoc
## create the vagrant user
sudo useradd -d /home/vagrant -m vagrant -p vagrant
@floodedcodeboy
floodedcodeboy / https_not_git.sh
Created October 11, 2013 17:28
Git use https:// instead of git://
git config --global url."https://".insteadOf git://
@floodedcodeboy
floodedcodeboy / vagrant portforwards
Created October 15, 2013 19:03
Port forward 80 to 8080 & 443 to 8443 for Vagrant development
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to me 80
sudo ipfw add 101 fwd 127.0.0.1,8443 tcp from any to me 443

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

@floodedcodeboy
floodedcodeboy / gist:10543057
Created April 12, 2014 16:01
Wordpress Migration search and replace for db
UPDATE wp_options SET option_value = REPLACE(option_value, ':8080', '');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ':8080', '');
UPDATE wp_posts SET post_content = REPLACE(post_content, ':8080', '');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, ':8080', '');
UPDATE wp_posts SET guid = REPLACE(guid, ':8080', '');
@floodedcodeboy
floodedcodeboy / basic-lamp.sh
Last active August 29, 2015 14:18
basic LAMP install
#!/bin/bash
## setup a consolidated list of of apt-get installs
apt-get update
apt-get --yes --force-yes install python-software-properties python software-properties-common
echo 'mysql-server mysql-server/root_password select "xxxxxx"' | debconf-set-selections
echo 'mysql-server mysql-server/root_password_again select "xxxxxx"' | debconf-set-selections
apt-get --yes --force-yes install apache2 mysql-server-5.5 mysql-client php5 libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-mcrypt php-pear php5-curl php5-common php5-dev
@floodedcodeboy
floodedcodeboy / default.conf
Created June 6, 2015 23:17
nginx magento subfolder config
## lifted shamelessly from http://stackoverflow.com/questions/19142004/nginx-magento-in-subfolder
server {
listen 80;
listen 443;
server_name www.domain.de domain.de *.domain.de;
root /var/www/domain.de/www.domain.de/htdocs;
index index.php;
access_log /var/log/nginx/domain_access.log;
error_log /var/log/nginx/domain_error.log;
@floodedcodeboy
floodedcodeboy / nginx-default
Created June 15, 2015 16:46
nginx cors setup
...
location / {
add_header Access-Control-Allow-Origin $http_origin;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE';
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, origin, accept';
add_header 'Access-Control-Allow-Credentials' 'true';
...
}
@floodedcodeboy
floodedcodeboy / varnishlog-examples.sh
Created May 4, 2018 09:53 — forked from cupracer/varnishlog-examples.sh
varnishlog examples (version 4.x)
# filter by request host header
varnishlog -q 'ReqHeader ~ "Host: example.com"'
# filter by request url
varnishlog -q 'ReqURL ~ "^/some/path/"'
# filter by client ip (behind reverse proxy)
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"'
# filter by request host header and show request url and referrer header