Skip to content

Instantly share code, notes, and snippets.

View kehh's full-sized avatar

Kehan Harman kehh

View GitHub Profile
@kehh
kehh / striptaxonomy.xslt
Created April 30, 2014 23:36
Strip taxonomy xslt
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--identity template copies everything forward by default-->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
@kehh
kehh / collectiveaccess_attributes_crosstab.sql
Last active December 30, 2020 10:18
CollectiveAccess crostab for attributes
-- This creates a mysql table which contains the values of
-- datamodel.conf so that we can use the values in constructing
-- queries
DROP TABLE IF EXISTS cmis_table_numbers;
CREATE TABLE cmis_table_numbers (
table_name VARCHAR(64) NOT NULL UNIQUE,
table_num INT(11) PRIMARY KEY,
@kehh
kehh / caIdentifications.sql
Created September 4, 2014 02:29
CollectiveAccess: Retrieve identification details
SET @sql = NULL;
SET @@group_concat_max_len = 50000000;
SELECT
GROUP_CONCAT(DISTINCT
CONCAT_WS("",
'MAX(IF(me.element_code = ''',
me.element_code,
''', coalesce(li.idno, concat_ws(";", av.value_longtext1,av.value_longtext2), concat_ws(" - ", av.value_decimal1, av.value_decimal2), av.value_integer1), NULL)) AS ''',
@kehh
kehh / dump.sh
Created September 15, 2014 08:34
Install multiple versions of CA and then diff the sql from the database dumps
#!/bin/bash -x
# Halt on any errors
set -e
# Halt on undefined variables
set -u
pushd $COLLECTIVEACCESS_HOME
pwd
git stash
function dbdump {
#!/bin/sh
# configure stuff
width=640
height=320
size=$width"x"$height
# show help
if [[ "$1" == "" || "$1" == "-h" || "$1" == "--help" ]]; then
echo "USAGE: ";
@kehh
kehh / clean_storage_locations.sql
Last active August 29, 2015 14:08
Clean Storage Locations
-- ssh wamadm@wamcmis
-- sudo su cmis
-- mysql cmis
begin;
create table sl_deletes as select location_id from ca_storage_location_labels where name = 'Kew Street' and location_id != 3;
alter table sl_deletes add primary key (location_id);
update ca_objects_x_storage_locations set location_id = 3 where location_id in (select location_id from sl_deletes);
set innodb_lock_wait_timeout=360;
delete from ca_storage_location_labels where location_id in (select location_id from sl_deletes);
<?php
/**
* Example usage (using jQuery):
* var url = "/path/mantisconnect_json.php?name=mc_project_get_issues&project_id=0&page_number=1&per_page=10";
* $.getJSON(url, function(data) {
* $.each(data, function() {
* console.log(data.id + ': ' data.summary);
* });
* });
*/
@kehh
kehh / 002-subdomains.conf
Created November 28, 2014 02:31
wildcard subdomains apache
<Directory /home/kehan/workspace>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
<?php
/**
* @file
* Custom Drush integration.
*/
/**
* Implements hook_drush_command().
*
* @return
@kehh
kehh / install_opengeo.md
Last active August 29, 2015 14:13
Installation script for opengeo suite installation