Skip to content

Instantly share code, notes, and snippets.

View kehh's full-sized avatar

Kehan Harman kehh

View GitHub Profile
Feature: Factsheet page type
As an administrative user I should be able to create factsheet pages.
@api
Scenario: Ability to create factsheet pages.
Given I am logged in as a user with the "Site editor" role
And I am on "/node/add/species-factsheet"
And I enter "Test common name" for "Title (Common Name)"
And I check the box "Arid"
And I enter "Test body" for "Body"
And I enter "Aus bus" for "Scientific Name"
@kehh
kehh / disk-speed-test.sh
Last active May 18, 2018 02:33
Disk read / write speed
#!/bin/bash
# Test read speed
sudo hdparm -Tt /dev/sda
# Results:
# /dev/sda:
# Timing cached reads: 18564 MB in 1.99 seconds = 9311.48 MB/sec
# Timing buffered disk reads: 1418 MB in 3.00 seconds = 472.03 MB/sec
# Test write speed
dd count=1k bs=1M if=/dev/zero of=~/test.img
# Results:
@kehh
kehh / cpuinfo
Created May 18, 2018 02:18
Laptop CPU Information
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4712HQ CPU @ 2.30GHz
stepping : 3
microcode : 0x24
cpu MHz : 2796.313
cache size : 6144 KB
@kehh
kehh / 50-server.cnf
Created May 17, 2018 04:30
MariaDB config for laptop with 16 G ram
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
@kehh
kehh / demo_users_per_role.sql
Created April 3, 2018 04:12
CA Demo Users Per Role
INSERT INTO ca_users (user_name, userclass, password, fname, lname, email, vars, volatile_vars, active, sms_number)
SELECT
code AS user_name,
0 AS userclass,
'' AS password,
name AS fname,
'Test User' AS lname,
CONCAT(code, '@csiro.au') AS email,
TO_BASE64('a:0:{}') AS vars,
TO_BASE64('a:0:{}') AS volatile_vars,
@kehh
kehh / View JSON.md
Last active November 30, 2017 03:58
View CollectiveAccess Record in JSON

Create a bookmark in your browser and pase the associated code into the URL of the link.

Creating a bookmarklet

@kehh
kehh / autossh.service
Last active August 25, 2017 01:37 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network-online.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@kehh
kehh / ca_objects_advanced_search_objects_html.php
Last active July 18, 2017 08:18
Template for producings a list of related galleries in pawtucket
<?php
// include this is ca_objects_advanced_search_objects_html.php adapted from
$vs_more_info = '';
$va_links = array();
// list of sets in which item is a member
$t_set = new ca_sets();
if (is_array($va_sets = caExtractValuesByUserLocale($t_set->getSetsForItem($t_object->tableNum(), $t_object->getPrimaryKey(), array('user_id' => $this->request->getUserID(), 'setType' => 'public_presentation', 'checkAccess' => true)))) && sizeof($va_sets)) {
foreach($va_sets as $vn_set_id => $va_set) {
$va_links[] = "<a href='".caNavUrl($this->request, 'Gallery', $vn_set_id, null)."'>".$va_set['name']."</a>";
@kehh
kehh / install-ca.sh
Last active May 14, 2018 19:48 — forked from anonymous/install-ca.sh
Install CollectiveAccess
#!/bin/bash
REGION="ap-southeast-2"
EFS="fs-a75dbd9e.efs.$REGION.amazonaws.com"
CMIS_ENV=cmis-uat
# Adapted from https://github.com/collectiveaccess/providence/blob/develop/Vagrantfile
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
set -e
@kehh
kehh / exportImporters.php
Created January 25, 2017 04:45
Export CollectiveAccess data importer
#!/usr/bin/php
<?php
require_once getenv('COLLECTIVEACCESS_HOME') . DIRECTORY_SEPARATOR . 'setup.php';
require_once __CA_MODELS_DIR__ . DIRECTORY_SEPARATOR . 'ca_data_importers.php';
$mapping = new ca_data_importers();
$importers = [];
$mapping_dir = 'mappings';
if (!is_dir($mapping_dir)) {
mkdir($mapping_dir);