Skip to content

Instantly share code, notes, and snippets.

View jonathonsim's full-sized avatar

Jonathon Sim jonathonsim

View GitHub Profile
@jonathonsim
jonathonsim / .htaccess
Last active April 14, 2020 00:11
Redirect http requests to https
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
[idealstack]
aws_account_id = 440805312024
[idealstackidentity]
role_arn = arn:aws:iam::440805312024:role/IdealstackAdminRole
source_profile = idealstack
region = us-west-2
color = 3D9970
[idealstacksandpit]
[idealstack]
aws_account_id = 440805312024
[idealstackidentity]
role_arn = arn:aws:iam::440805312024:role/IdealstackAdminRole
source_profile = idealstack
region = us-west-2
color = 3D9970
[idealstacksandpit]
@jonathonsim
jonathonsim / install-test-moodle.sh
Last active January 14, 2020 22:18
install a simple test version of moodle
#Install moodle via commandline
if [[ -z $5 ]]; then
echo "Usage $0 url dbhost dbname dbuser dbpass"
exit 1
fi
cd ~
curl -O https://download.moodle.org/download.php/direct/stable38/moodle-3.8.1.tgz
tar -xzf moodle-3.8.1.tgz
shopt -s dotglob nullglob
@jonathonsim
jonathonsim / install-test-wp.sh
Last active January 14, 2020 22:17
Sript to install a test copy of wp for benchmarking and testing. Usage is ` curl https://gist.githubusercontent.com/jonathonsim/09b9fc5ca9c387fed01cdcb618df1520/raw/install-test-wp.sh | bash -s -- wpdb dbuser dbpass`
#!/bin/bash
if [[ -z $5 ]]; then
echo "Usage $0 url dbhost dbname dbuser dbpass"
exit 1
fi
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mkdir ~/bin
@jonathonsim
jonathonsim / deploy.sh
Last active February 7, 2019 03:21
Idealstack Deployment example
#!/bin/bash
#Copyright 2017-2019, Idealstack Limited
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
#documentation files (the "Software"), to deal in the Software without restriction, including without limitation
#the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
#and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
@jonathonsim
jonathonsim / setup_lamp_xenial_vagrant.sh
Last active February 1, 2019 01:55
Setup a standard LAMP stack inside a vagrant box.
#To run this add something like this to your Vagrantfile:
#
#
# config.vm.provision "shell", inline: <<-SHELL
# # Default Vagrant LAMP stack https://gist.github.com/jonathonsim/2cfdafc876984f6a6a0bdb35ebd9a74f
# export VAGRANT_DIR=/var/www/html #We mount an nfs share here, along with the regular vagrant share on /vagrant, as nfs is faster. But it has weird behaviour with some apps as well
# curl https://gist.githubusercontent.com/jonathonsim/2cfdafc876984f6a6a0bdb35ebd9a74f/raw/ | bash
# SHELL
#
#
@jonathonsim
jonathonsim / setup_php_xenial.sh
Last active November 25, 2018 22:14
A script to install a PHP development environment in an ubuntu xenial vagrant box
#To use:
# (assuming you trust it):
#curl https://gist.githubusercontent.com/jonathonsim/6a5b25a4bebf2badde9a10740476fc3a/raw/ | bash
export DEBIAN_FRONTEND=noninteractive
#Use local mirrors
echo "deb http://nz.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse" > /etc/apt/sources.list && \
echo "deb http://nz.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://nz.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse" >> /etc/apt/sources.list
<?php
/**
* Idealstack Healthcheck.
*
* This file is checked by the load balancer to see whether the site is healthy.
* If it returns a 500 error the site is considered unhealthy, and the site's container
* will be rebooted.
*
* This default check doesn't do much except check that PHP is running.
* You can customise this file to check other important resources
@jonathonsim
jonathonsim / setup_bash_profile.sh
Last active October 23, 2018 22:23
Setup .bash_profile on cygwin (ZEALD VERSION)
#To use:
# (assuming you trust it):
#curl https://gist.githubusercontent.com/jonathonsim/cc286f3baed66faed69e3be2d4608858/raw/ | bash
cd ~
chmod 777 ~/bin/*
cat > ~/.bash_profile <<'EOF'
# source the users bashrc if it exists
if [ -f "${HOME}/.bashrc" ] ; then
source "${HOME}/.bashrc"