Skip to content

Instantly share code, notes, and snippets.

Ben New leftclickben

Block or report user

Report or block leftclickben

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
leftclickben /
Last active Nov 13, 2019
Experiment: gist as a blogging platform

Experiment: gist as a blogging platform

Am I crazy? Perhaps. But why shouldn't we use gist as a blogging platform?

What it has going for it

  • support for comments
  • renders markdown
  • support for multiple files, so code examples can be attached as well as inline
  • automatic indexing by search engines
leftclickben / ubuntu-node-setup-5.x
Created Jan 22, 2016
Complete instructions for installing node 5.x on Ubuntu via apt (should work for other versions, just change `5.x`)
View ubuntu-node-setup-5.x
curl -sL | sudo -E bash -
sudo apt-get install nodejs
sudo chown -R $USER /usr/lib/node_modules/
sudo chgrp $USER /usr/bin
sudo chmod g+w /usr/bin
leftclickben / git-update
Last active Jul 29, 2016
Pull down latest from git remote and remove dead branches
View git-update
# git-update
# Pull down latest from git remote and remove dead branches
# To create an alias to `git update`, put this on your path, then:
# git config --global alias.update '!git-update'
# Copyright (c) 2016
# License: MIT
leftclickben / admin-access.js
Last active Jul 4, 2018 — forked from spencermefford/0-model-override.js
An alternative to extending Loopback's built-in models: use a boot script to enhance the built-in model
View admin-access.js
(function () {
'use strict';
// Relevant resource:
module.exports = function (server, callback) {
var ACL = server.models.ACL,
User = server.models.User,
Role = server.models.Role,
RoleMapping = server.models.RoleMapping;
View strip-referer
perl -pe 's/\s+\[\:error\]\s+\[pid\s+\d+\]\s+\[client\s+.*?\]//; s/, referer:.*//'
leftclickben / describeScreen.php
Last active Aug 29, 2015
(CollectiveAccess) Retrieve CSV of placements for a given screen, with labels
View describeScreen.php
#!/usr/bin/env php
$screen = 35; // modify as required
$locale = 'en_AU';
$pdo = new PDO('mysql:host=wamcmisdb01-staging;dbname=cmis', 'cmis', 'uhkdv5Uwhkk7pmv');
$placements = $pdo->query('select * from ca_editor_ui_bundle_placements where screen_id = ' . $screen . ' order by rank asc')->fetchAll();
foreach ($placements as $placement) {
$settings = unserialize(base64_decode($placement['settings']));
leftclickben / nestedRenameSpacesToUnderscores
Last active Aug 29, 2015
Rename whitespace in files to underscores, with any level of nesting
View nestedRenameSpacesToUnderscores
maxdepth=`find . -printf '%d\\n' | sort -n | tail -1` && for depth in `seq 1 $maxdepth`; do find -mindepth 1 -maxdepth $depth -exec bash -c 'f=`echo "{}" | sed -r s:\\\s+:_:g` ; if [ "$f" != "{}" ]; then mv "{}" "$f"; fi' \; ; done
leftclickben / gist:322b7a3042cbe97ed2af
Last active Feb 27, 2020
Steps to migrate from SVN to GitLab
View gist:322b7a3042cbe97ed2af

Steps to migrate from SVN to GitLab

This process worked for me. I take no responsibility for any damage or loss incurred as a result of following or not following these steps or, for that matter, anything else you might do or not do.


  • SVN is hosted at
  • SVN is accessible via http (other protocols should work).
  • GitLab is hosted at and:
leftclickben / test-ldap-2.php
Last active Jul 5, 2019
Open a connection to an LDAP server, query it for a given user, and check group membership for that user (test script)
View test-ldap-2.php
# Parse options
$opts = getopt('h:n:u:p:b:s:', array( 'help' ));
if (isset($opts['help']) && $opts['help']) {
echo <<<ENDHELP
$argv[0] [-h HOSTNAME] [-n PORTNUM] [-u USERNAME] [-p PASSWORD] [-b BASEDN] [-s SEARCH]
leftclickben / cleanup-providence-database-after-relationship-generator-integration-test.sql
Created May 14, 2014
View cleanup-providence-database-after-relationship-generator-integration-test.sql
-- Cleans up any data that might be remnant after a run of the RelationshipGeneratorPluginIntegrationTest,
-- particularly if the run fails for some reason, it might not execute its tearDown() and can leave remnant
-- data in the database.
-- Alternatively this could probably be improved to use more of the "code like '%...%'" and less of the "id > X" style
delete from ca.ca_attribute_values where value_id > 14;
delete from ca.ca_attributes where table_num = 57 and element_id = 70 and row_id > 46;
You can’t perform that action at this time.