Skip to content

Instantly share code, notes, and snippets.

View stevewithington's full-sized avatar
⛑️
solving problems

Steve Withington stevewithington

⛑️
solving problems
View GitHub Profile
#!/bin/bash -e
ln -s /usr/lib/x86_64-linux-gnu/amdgpu-pro .
ln -s /etc/OpenCL .
tar -czvf libs.tar.gz amdgpu-pro/*
tar -czvf conf.tar.gz OpenCL/*
cat > .dockerignore << EOF
OpenCL
@stevewithington
stevewithington / screen-docker-for-mac.sh
Created September 20, 2017 15:38 — forked from BretFisher/docker-for-mac.md
Screen Commands for Docker for Mac (prevent garbled text on reconnect)
# connect to tty on Docker for Mac VM
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
# disconnect that session but leave it open in background
Ctrl-a d
# list that session that's still running in background
screen -ls
# reconnect to that session (don't open a new one, that won't work and 2nd tty will give you garbled screen)
@stevewithington
stevewithington / mura-js-chaining-async-with-promises.js
Last active September 8, 2017 02:22
Mura CMS: Mura.js chaining multiple asynchronous calls with JavaScript Promises
var exampleFunc1 = function() {
return new Promise(function (resolve, reject) {
Mura.post('https://domain.com/path/', { apikey: 'value' })
.then(function(result) {
if ( result.hasOwnProperty('id') ) {
resolve(result);
} else {
reject('result does not contain an id');
}
})
@stevewithington
stevewithington / plate-snitch.js
Created September 1, 2017 18:04 — forked from taitems/plate-snitch.js
(Extract) Check the status of a vehicle registration and scrape results.
// Open form and submit enquire for `rego`
function getInfo(rego) {
horseman
.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0')
.open(url)
.type('#registration-number-ctrl input[type=text]', rego)
.click('.btn-holder input')
.waitForSelector('.ctrl-holder.ctrl-readonly')
.html()
.then(function(body) {
@stevewithington
stevewithington / mura-head-meta-og.cfm
Last active July 8, 2019 18:26
Mura CMS: Sample Open Graph Meta Tags for a Mura CMS Website
<!--- Open Graph (http://ogp.me) --->
<meta property="og:site_name" content="#esapiEncode('html_attr', m.siteConfig('site'))#" />
<meta property="og.locale" content="#m.siteConfig('javalocale')#" />
<meta property="og:title" content="#esapiEncode('html_attr', m.content('title'))#" />
<meta property="og:type" content="website" />
<meta property="og:url" content="#m.createHref(filename=m.content('filename'), complete=true)#" />
<cfif Len(m.getURLForImage(fileid=m.content('fileid')))>
<meta property="og:image" content="#m.getURLForImage(fileid=m.content('fileid'), size='large', complete=true)#" />
</cfif>
<cfif Len(m.content('metadesc'))>
@stevewithington
stevewithington / onContentEditMessageRender.cfm
Created May 10, 2017 18:11
Mura CMS: Admin Alert & Help Block Messages
<cfscript>
// add to an event handler
public any function onContentEditMessageRender(event, m) {
// reference to the event, if needed
var e = arguments.event;
// could also get a reference to event via Mura Scope
var mse = arguments.m.event();
// this example merely shows how to render a simple message
@stevewithington
stevewithington / component_index.cfm
Created March 16, 2017 20:14
Mura CMS: How to enable editable components in Mura 7 similar to how they worked in Mura 6.
<!---
NOTE:
In Mura 6, using '$.dspObject(object='component', objectid='Some Component')' in a layout template
would generate a pencil icon for content manager to edit the component from the front-end view of the site.
In Mura 7, we have migrated to using a layout manager for front-end edits. However, this old functionality no longer works.
So, here's a workaround to accomplish something very similar to the functionality in Mura 6.
1. Under your theme, create a directory labeled 'content_types' if it doesn't already exist
2. Under the 'content_types' directory, create another directory labeled 'component'
@stevewithington
stevewithington / osx_uninstall_mysql_install_mariadb_homebrew.md
Created February 8, 2017 17:14 — forked from brandonsimpson/osx_uninstall_mysql_install_mariadb_homebrew.md
OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

This is a short overview on how to completely remove any old mysql server installs in OSX and upgrade to MariaDB without conflicts. Things can get a bit weird when you have various old installs of MySQL server floating around, and utilizing homebrew to install and upgrade MariaDB as a drop in replacement for MySQL has worked well, especially if you're used to managing MySQL installs via yum in linux.

First: Backup Your Data!

Backup all of your current databases with mysqldump

This isn't a tutorial on backups, and there are many ways to do it. You should know how to backup your data anyway. For this example, we'll do a full backup of our InnoDB databases.

@stevewithington
stevewithington / mura-js-form.js
Last active April 27, 2018 19:09
Mura CMS: How to manipulate the DOM of a form in Mura CMS v7+
<script>
Mura.DisplayObject.Form.reopen({
onAfterRender: function() {
//this.context.targetEl is a pointer to the dom element that contains the rendered Mura form.
var container = Mura(this.context.targetEl);
console.log(this.context.targetEl);
}
@stevewithington
stevewithington / primary-nav-with-images.cfm
Last active April 27, 2018 19:10
Mura CMS: Custom primary navigation with primary associated images as links.
<!--- Mura 6.2 Syntax (will work in 7.0 as well) --->
<cfset it = $.getBean('feed').addParam(relationship='AND', field='parentid', condition='EQ', criteria='00000000000000000000000000000000001').getIterator() />
<!--- Mura 7.0 Syntax --->
<!--- <cfset it = $.getBean('feed').where().prop('parentid').isEQ('00000000000000000000000000000000001').getIterator() /> --->
<cfif it.hasNext()>
<ul>
<cfloop condition="it.hasNext()">
<cfset item = it.next() />
<li>
<a href="#item.getURL()#">