Skip to content

Instantly share code, notes, and snippets.

View kehh's full-sized avatar

Kehan Harman kehh

View GitHub Profile
@kehh
kehh / change_db_owner.sh
Created October 19, 2012 01:42 — forked from sharoonthomas/change_db_owner.sh
Postgresql - Changing ownership on all tables
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@kehh
kehh / warsync.sh
Created October 31, 2012 08:03
Warsync - a tool for speeding up rsync of war files by unzipping them on the source and target and then rsyncing the diffs
#!/bin/bash
#Warsync - a tool for speeding up rsync of war files by unzipping them on the source and target and then rsyncing the diffs
echo "Usage: $0 source.war destinationserver"
CURRENTDIR=$PWD
WARFILE="$CURRENTDIR/$1"
REMOTEHOST=$2
CURRENTUSER=$USER
REMOTEHOME="/home/$CURRENTUSER"
WARFILENAME=`basename $1`
echo "source is $WARFILE target is $TARGET"
{
"intrinsic_fields" : {
"idno" : "TEST-123",
"type_id" : 43
},
"preferred_labels" : [
{
"locale" : "en_US",
"forename" : "Walter",
"middlename" : "H.",
{
"intrinsic_fields" : {
"idno" : "NEWTEST-456",
},
"remove_all_labels" : true,
"preferred_labels" : [
{
"locale" : "en_US",
"forename" : "Walter",
"middlename" : "H.",
@kehh
kehh / add_en_AU_make_query.sql
Last active December 15, 2015 09:59
ICA AtoM create en_AU locale see results in https://gist.github.com/kehh/5242861
select concat ("update `", table_name, "` set ", column_name, " = 'en_AU' where ", column_name, " = 'en';") as 'BEGIN;' from information_schema.columns where column_name = 'source_culture' and table_name not in ('taxonomy', 'term', 'setting', 'loan');
select 'SHOW WARNINGS;';
select concat("delete from `", table_name, "` where culture = 'en_AU'; replace into `", table_name,"` (", group_concat(column_name), ", culture) select ", group_concat(column_name), ", 'en_AU' as culture from `", table_name, "` where culture = 'en';") as 'begin;' from information_schema.columns where table_schema='qubit' and table_name like '%i18n' and column_name != 'culture' group by table_name order by table_name, column_name;
select 'SHOW WARNINGS;';
select 'COMMIT;';
BEGIN;
update `accession` set source_culture = 'en_AU' where source_culture = 'en';
update `acl_group` set source_culture = 'en_AU' where source_culture = 'en';
update `actor` set source_culture = 'en_AU' where source_culture = 'en';
update `contact_information` set source_culture = 'en_AU' where source_culture = 'en';
update `deaccession` set source_culture = 'en_AU' where source_culture = 'en';
update `event` set source_culture = 'en_AU' where source_culture = 'en';
update `function` set source_culture = 'en_AU' where source_culture = 'en';
update `information_object` set source_culture = 'en_AU' where source_culture = 'en';
update `menu` set source_culture = 'en_AU' where source_culture = 'en';
id name priority who time status
T-024 Organisation list in directory MUST Joe 5 Complete
T-015 Make term Commissions customisable MUST Natasha 6 Complete
T-016 Comments popup on select rates MUST Mike 3 In Progress
T-0169 Upgrade Centos Box MUST Joe 2 In Progress
T-013 Search in Documents on selected folder MUST Natasha 6 In Progress
T-014 Separate Document system for LA and Legals MUST Joe 9 In Progress
T-017 Demo of Look and Feel of Documents front end MUST Natasha 5 In Progress
T-021 Fix error where forum filename is greater than 100chars MUST Mike 4 Not Started
T-025 Fix admin so structure of categories displayed MUST Mike 2.5 Complete
@kehh
kehh / st_split.sql
Last active December 17, 2015 10:39
Wrapping polygons so they don't sit on the date line Requires st_split http://postgis.17.x6.nabble.com/ST-Split-in-1-5-tp4999369p4999388.html st_split for postgis 1.5 st_wrapx from: https://github.com/mci/mpatlas/blob/master/mpatlas/ST_WrapX.sql
CREATE OR REPLACE FUNCTION st_split(polygon geometry,split_line geometry) RETURNS SETOF geometry AS
$$
DECLARE
v_geometry geometry;
BEGIN
FOR v_geometry IN SELECT (ST_Dump((
ST_Polygonize(ST_Union(ST_Boundary(polygon),split_line))
@kehh
kehh / index.html
Last active December 25, 2015 18:09 — forked from lxbarth/index.html
<!DOCTYPE html>
<html>
<head>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
@kehh
kehh / opengeo-suite-install.sh
Last active August 29, 2015 13:56
Install opengeo suite
#!/bin/bash
# setup repository
sudo wget -qO- http://apt.opengeo.org/gpg.key | apt-key add -
sudo chmod 655 /etc/apt/sources.list
sudo echo "deb http://apt.opengeo.org/suite/v4/ubuntu precise main" >> /etc/apt/sources.list
sudo chmod 644 /etc/apt/sources.list
sudo apt-get update
# install opengeo suite