Skip to content

Instantly share code, notes, and snippets.

View heathdutton's full-sized avatar
🕴️
🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈

Heath Dutton ☕ heathdutton

🕴️
🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈
  • ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  • Tampa Florida
  • https://orcid.org/0009-0005-9397-422X
View GitHub Profile
@heathdutton
heathdutton / gist:4150767
Created November 26, 2012 21:34
Magento Custom - Delete instances of deleted product "Santa Margherita Prosecco" from pending holidays that have not yet been purchased.
DELETE FROM
enterprise_giftregistry_item
WHERE
enterprise_giftregistry_item.item_id IS IN (667, 31013, 33823, 35795, 35826);
@heathdutton
heathdutton / gist:4274386
Created December 13, 2012 05:55
List of all boats in Drupal SS as per TMW-679.
SELECT
core_fleet_boats.code as 'Boat Code',
core_fleet_boats.name as 'Boat Name',
core_bs_node_extras.search_description as 'Short Boat Description',
CONCAT('http://www.sunsail.co.uk/', (core_files.filepath)) as 'Layout Image URL', /* note, this is the original file, not web-optimized */
/* Get the first 4 images of this boat as columns */
CONCAT('http://www.sunsail.co.uk/', (SELECT core_files.filepath FROM
core_content_field_gallery,
core_files
WHERE
@heathdutton
heathdutton / gist:4288090
Created December 14, 2012 19:49
Find all instances of registry/holiday products that are missing from the website that they exist in.
/* Find all instances of registry/holiday products that are missing from the website that they exist in */
SELECT * FROM
enterprise_giftregistry_item,
enterprise_giftregistry_entity,
catalog_product_website
WHERE
enterprise_giftregistry_entity.entity_id = enterprise_giftregistry_item.entity_id AND /* get the registry entity */
enterprise_giftregistry_item.product_id = catalog_product_website.product_id AND /* get the product entity */
enterprise_giftregistry_entity.website_id NOT IN (
SELECT
@heathdutton
heathdutton / gist:5629473
Created May 22, 2013 17:50
A bookmarklet to expand a krumo dump. No libraries needed.
javascript:styles%3D%27div.krumo-nest %7Bdisplay: block !important%3B%7D%27%3B newSS %3D document.createElement(%27link%27)%3B newSS.rel %3D %27stylesheet%27%3B newSS.href %3D %27data:text/css,%27 %2B escape(styles)%3B document.documentElement.childNodes%5B0%5D.appendChild(newSS)%3B void 0
@heathdutton
heathdutton / logs
Created November 3, 2015 20:05
Get Acquia enterprise logs from a quick command line shell
#!/bin/bash
# Retrieves past and present logs for a site in Acquia Enterprise
# Put this in your /usr/local/bin folder and chmod it 0755
# Then you can search/view logs quickly from any terminal
if [ "$1" = "" ] || [ "$2" = "" ]
then
echo "Retrieves past and present logs for a site in Acquia Enterprise"
echo "Usage: $0 <site-alias> <site-environment>"
echo "Example: $0 qrk test"
@heathdutton
heathdutton / linkedin_auto_connect.js
Last active November 9, 2016 02:38
Apparently, JavaScript CAN make you new friends.
/**
* Linkedin auto-connect thingy.
*
* Step 1) Log in to Linkedin and go to https://www.linkedin.com/people/pymk
* (This is the "People You May Know page")
* Step 2) Open your browser console and run this javascript.
*/
(function($) {
var processedCards = [];
var lih = function(){
@heathdutton
heathdutton / cf_cloud_all.sh
Created July 26, 2017 18:44
Enable Cloudflare on all CNAME records.
#! /bin/bash
cf_user=<inset your email address here>
cf_token=<inset your api token here>
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
if [ -z $1 ]
@heathdutton
heathdutton / UnpackCSVJSON.php
Last active December 5, 2017 20:28
Takes a CSV with JSON in it, and makes it more usable as a CSV with columns extracted.
<?php
/**
* Automatically extrapolate JSON keys/values from a CSV into their own columns.
* JSON is flattened, and null values/keys are ignored.
*
* Usage:
*
* php UnpackCSVJSON.php original.csv destination.csv
*/
$file = $argv[1];
@heathdutton
heathdutton / jobs_copy.sql
Last active January 3, 2018 14:57
Laravel jobs concurrency untangling
DROP TABLE IF EXISTS jobs_copy;
CREATE TABLE `jobs_copy` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `queue` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `payload` text COLLATE utf8_unicode_ci NOT NULL, `attempts` tinyint(3) unsigned NOT NULL, `reserved` tinyint(3) unsigned NOT NULL, `reserved_at` int(10) unsigned DEFAULT NULL, `available_at` int(10) unsigned NOT NULL, `created_at` int(10) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=29972441 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `jobs_copy` SELECT * FROM `jobs`;
DELETE FROM jobs WHERE `reserved` != 1 AND `id` IN (SELECT `id` FROM jobs_copy ORDER BY `id` DESC);
# Repeat ad nauseam:
INSERT INTO `jobs` (SELECT * FROM `jobs_copy` ORDER BY `id` ASC LIMIT 500); DELETE FROM `jobs_copy` ORDER BY `id` ASC LIMIT 500; SELECT SLEEP(18); SELECT COUNT(*) FROM `jobs`;
@heathdutton
heathdutton / mautic_eb_multi.sql
Last active January 8, 2018 15:17
Initial database for Mautic-EB Multisite. To be imported into a DB named mautic_eb_multi within the same RDS as Mautic. Note: This is just a rough draft!
# ************************************************************
# Database: mautic_eb_multi
# ************************************************************
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;