Skip to content

Instantly share code, notes, and snippets.

View CashWilliams's full-sized avatar

Cash Williams CashWilliams

View GitHub Profile
curl https://ftp.drupal.org/files/projects/drupal-8.6.0-beta2.tar.gz | tar xz && cd drupal-8.6.0-beta2 && php core/scripts/drupal quick-start standard
@CashWilliams
CashWilliams / .htaccess
Created April 15, 2018 02:26
htaccess php file handler
<Files *>
SetHandler application/x-httpd-php
</Files>
@CashWilliams
CashWilliams / quick-umami
Created March 2, 2018 03:27
Quick Drupal umami demo (with sqlite)
#!/bin/sh
wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet
php composer.phar create-project drupal/drupal:8.5.0-rc1 --no-dev
cd drupal
php ../composer.phar require drush/drush
./vendor/drush/drush/drush si demo_umami --account-pass=admin --db-url=sqlite://sites/default/files/.ht.sqlite -y
./vendor/drush/drush/drush rs
@CashWilliams
CashWilliams / quick-drupal.sh
Last active March 1, 2018 22:46
quick drupal
#!/bin/sh
wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet
php composer.phar create-project drupal/drupal --no-dev
cd drupal
php ../composer.phar require drush/drush
./vendor/drush/drush/drush si --account-pass=admin --db-url=sqlite://sites/default/files/.ht.sqlite -y
./vendor/drush/drush/drush rs
@CashWilliams
CashWilliams / gist:34400609bc5fa9e77f64
Created March 17, 2016 06:02
LibrePilot Build Error
$ cd LibrePilot/
make all_sdk_install~/Code/Flight/LibrePilot
(next) $ make all_sdk_install
NOTE Sanitized disallowed variable 'TMPDIR' from environment
NOTE Use 'make all_sdk_distclean' to remove installation files
NOTE Use 'make all_sdk_version' to check toolchain versions
NOTE Add 'V=1' to make command line to diagnose make problems
NOTE Add 'BATCH=1' to make command line to disable progress reporting during downloads
WARNING tools/osg-3.5.1-clang_64-qt-5.5.1 not found (make osg_install), using system PATH
WARNING tools/osgearth-2.7-clang_64-qt-5.5.1 not found (make osgearth_install), using system PATH
@CashWilliams
CashWilliams / gist:901f16e32b3d9f77a15f
Created April 15, 2015 16:26
Read only Drupal site

#Create a readonly front-end multisite

Client wants to have a front-end 'readonly' site in which no users will ever login. The main goal of this is to create a secure site that someone cannot use access bypass or escalation of privileges to gain access to a trusted role of any kind. This example assumes the site is using syslog, not dblog, which is a general recommendation.

  1. Create a database user which has readonly access to the database.

  2. Add write access for the database user for the following tables:

     -- Minium needed to function
    

GRANT INSERT, UPDATE, DELETE ON project.semaphore TO 'project_ro'@'localhost';

function getCodeNumberByName($name) {
switch ($name) {
case 'Edward Donne':
return 001;
case 'Scarlett Papava':
return 004;
case 'Stuart Thomas':
return 006;
case 'James Bond':
return 007;
<?php
function getCodeNumberByName($name) {
switch ($name) {
case 'Edward Donne':
return 001;
case 'Scarlett Papava':
return 004;
case 'Stuart Thomas':
return 006;
@CashWilliams
CashWilliams / Drupal Fields Over Time
Created January 28, 2015 17:12
Chart from git repo to show Drupal field changes over time
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2015 Sébastien Helleu <flashcode@flashtux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
@CashWilliams
CashWilliams / gist:8733693
Created January 31, 2014 15:03
Markdown Example

An exhibit of Markdown

This note demonstrates some of what [Markdown][1] is capable of doing.

Note: Feel free to play with this page. Unlike regular notes, this doesn't automatically save itself.

Basic formatting

Paragraphs can be written like so. A paragraph is the basic block of Markdown. A paragraph is what text will turn into when there is no reason it should become anything else.