Skip to content

Instantly share code, notes, and snippets.

View camfindlay's full-sized avatar

Cam Findlay camfindlay

View GitHub Profile

The command line, in short…

wget -k -K -E -r -l 10 -p -N -F --restrict-file-names=windows -nH http://website.com/

…and the options explained

  • -k : convert links to relative
  • -K : keep an original versions of files without the conversions made by wget
  • -E : rename html files to .html (if they don’t already have an htm(l) extension)
  • -r : recursive… of course we want to make a recursive copy
  • -l 10 : the maximum level of recursion. if you have a really big website you may need to put a higher number, but 10 levels should be enough.
@camfindlay
camfindlay / macos_high_sierra_apache_php_brew_2018.md
Created September 18, 2019 04:04 — forked from karlhillx/macos_high_sierra_apache_php_brew_2018.md
macOS High Sierra Setup: Homebrew + Apache + PHP + MariaDB + SSL

macOS High Sierra Setup: Homebrew + Apache + PHP + MariaDB + SSL

Homebrew Installation

First let's install Homebrew.

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Lots of stack traces and error messages for CKAN, followed by a comment about how I fixed it (that time).
NB don't email me privately for help - ask on StackOverflow #ckan instead.
David
File "/vagrant/src/ckan/ckan/templates/home/snippets/search.html", line 1, in top-level template code
{% set tags = h.get_facet_items_dict('tags', limit=3) %}
File "/vagrant/src/ckan/ckan/lib/helpers.py", line 949, in get_facet_items_dict
if not c.search_facets or \
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
@camfindlay
camfindlay / nginx_modsite.sh
Created May 21, 2017 09:38
Adds commands to enable and disable nginx vhosts similar to a2ensite etc.
#!/bin/bash
##
# File:
# nginx_modsite
# Description:
# Provides a basic script to automate enabling and disabling websites found
# in the default configuration directories:
# /etc/nginx/sites-available and /etc/nginx/sites-enabled
# For easy access to this script, copy it into the directory:
@camfindlay
camfindlay / scheme.jsonld
Created February 27, 2017 22:23
data.json schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://project-open-data.cio.gov/v1.1/schema/catalog.json#",
"title": "Project Open Data Catalog",
"description": "Validates an entire collection of Project Open Data metadata JSON objects. Agencies produce said collections in the form of Data.json files.",
"type": "object",
"dependencies": {
"@type": [
"@context"
]
@camfindlay
camfindlay / GoogleAnalyticsExtension.php
Created April 7, 2016 05:25
Example of custom Google Analytics integration for SilverStripe CMS
<?php
class GoogleAnalyticsExtension extends DataExtension {
private static $db = array(
'GoogleAnalyticsTrackingID' => 'Varchar(11)',
);
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab('Root.GoogleAnalytics', TextField::create('GoogleAnalyticsTrackingID')->setDescription('e.g. UA-XXXXX-XX'));
@camfindlay
camfindlay / gist:50bf3dd1cfaa42addcf7
Created August 27, 2015 04:12
Switch to SQLite3 for testing when a query string is passed in
if (Director::isDev()) {
if (isset($_GET['db']) && $db = $_GET['db']) {
if ($db == 'sqlite3') {
$databaseConfig['type'] = 'SQLite3Database';
$databaseConfig['memory'] = true;
}
}
@camfindlay
camfindlay / gist:4cef980c1fbabca5bdbe
Created August 26, 2015 21:36
Get change log messages for github module releases
git log --left-right --cherry-pick --oneline --pretty=format:"%h: %s (%an)" branch1...branch2
@camfindlay
camfindlay / gist:4041dfd154e0d176cd81
Last active August 29, 2015 14:27
Simple deploy script for SilverStripe
#/bin/sh
# Requires: git, composer, sspak, php
echo "Taking a backup"
d=$(date +%Y%m%d%H%M%S)
sspak save /home/bitnami/htdocs ~/backup/$d.sspak
cd ~/htdocs
git fetch
echo "Deploying production release branch"
@camfindlay
camfindlay / post-receive
Created August 9, 2015 07:35
Git post-receive hook for simple SilverStripe deployment
#!/bin/sh
#Deploy
git --work-tree=/path/to/webroot --git-dir=/path/to/repo.git checkout -f <branch>
#Run composer and dev/build
cd /path/to/webroot
composer install --no-dev --prefer-dist
php ./framework/cli-script.php dev/build flush=1