Skip to content

Instantly share code, notes, and snippets.

View waynegraham's full-sized avatar

Wayne Graham waynegraham

View GitHub Profile
@waynegraham
waynegraham / Vagrantfile
Created August 27, 2019 15:57
Migrate Sympa to Listserv
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get upgrade
apt-get install -y python libmail-mboxparser-perl
2018-06-26 21:43:28 INFO Zope Ready to handle requests
2018-06-26 21:43:28 WARNING OFS.Uninstalled Could not import class 'SOAPUtil' from module 'contextual.higherlogic.soaputil.SOAPUtil'
2018-06-26 21:43:28 WARNING OFS.Uninstalled Could not import class 'VocabularyLibrary' from module 'Products.ATVocabularyManager.tools.vocabularylib'
2018-06-26 21:43:28 WARNING OFS.Uninstalled Could not import class 'FormGenTool' from module 'Products.PloneFormGen.tools.formGenTool'
2018-06-26 21:43:28 WARNING OFS.Uninstalled Could not import class 'SmartlinkConfig' from module 'redturtle.smartlink.utility'
2018-06-26 21:43:28 WARNING OFS.Uninstalled Could not import class 'ISmartlinkConfig' from module 'redturtle.smartlink.interfaces.utility'
2018-06-26 21:43:28 WARNING OFS.Uninstalled Could not import class 'IDropdownSpecific' from module 'webcouturier.dropdownmenu.browser.interfaces'
2018-06-26 21:43:28 WARNING OFS.Uninstalled Could not import class 'ICollectivePortletClassLayer' from module 'collective.portletclass.inte
@waynegraham
waynegraham / api.md
Created April 5, 2018 15:13
API prototype
{
  //Metadata about this manifest file
  "@context": "https://api.clir.org/grants/1/context.json",
  "@id": "https://www.example.edu/grants/grant##/manifest",
  "@type": "sc:Manifest",
  // Descriptive metadata about the object/work
  "label": "Recording 1",
  "metadata": [
 {"label": "Name", "value": "Object name"},
@waynegraham
waynegraham / jekyll-deploy.md
Last active March 21, 2018 20:06
Travis deployment of Jekyll sites with Let's Encrypt on Ubuntu.
@waynegraham
waynegraham / converts.sh
Created February 14, 2018 16:19
ImageMagic convert for icons
# IE is still braindead so still use favicon.ico
convert -resize x16 -gravity center -crop 16x16+0+0 -flatten -colors 256 input.png output-16x16.ico
convert -resize x32 -gravity center -crop 32x32+0+0 -flatten -colors 256 input.png output-32x32.ico
convert output-16x16.ico output-32x32.ico favicon.ico
# Then, HTML needs to specify size="XxY" as largest size due to browser bugs
<link rel="shortcut icon" href="/favicon.ico" sizes="32x32">
@waynegraham
waynegraham / repair_hard_drive.md
Last active August 28, 2025 07:24
Repair Hard Drive

I ran in to a problem with a new Western Digital hard drive (2TB) for use as a Time Machine backup drive on High Sierra. After plugging it in, I kept getting errors like "MediaKit reports not enough space on device for requested operation." After some digging, it appeared that this is an issue in macOS with initializing APFS from an NTFS partition.

Pulling out some old utils, I used diskutil and dd to fix the issue:

$ disktuil list
...
/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk4
@waynegraham
waynegraham / gist:0de8913dcb4f962b3e146d7fea71be06
Last active February 8, 2018 19:06
Replace string in the WordPress database

see https://developer.wordpress.org/cli/commands/search-replace/

wp search-replace --url=dlf.wordpress.clir.org 'dlf.wordpress.clir.org/wp-content/uploads/20' 'dlf.wordpress.clir.org/wp-content/uploads/sites/3/20' --dry-run

wp search-replace --url=diglib.org 'dlf.wordpress.clir.org' 'www.diglib.org' --skip-columns=guid --skip-tables=wp_users --network --dry-run

@waynegraham
waynegraham / .htaccess
Last active November 28, 2017 21:36
DLF URL Mappings
Redirect permanent /archives/14864 /fellow-reflection-mary-jo-fayoyin
Redirect permanent /archives/14849 /
Redirect permanent /archives/14856 /fellow-reflection-sandy-rodriguez
Redirect permanent /archives/14840 /fellow-reflection-letisha-stacey
Redirect permanent /archives/14834 /fellow-reflection-david-bliss
Redirect permanent /archives/14811 /dlf-forum-recap-and-working-group-news
Redirect permanent /archives/14815 /fellow-reflection-christy-hyman
Redirect permanent /archives/14806 /fellow-reflection-kaneisha-gaston
Redirect permanent /archives/14799 /fellow-reflection-nushrat-khan
Redirect permanent /archives/14789 /fellow-reflection-danisha-baker-whitaker
@waynegraham
waynegraham / import.php
Created November 1, 2017 20:17
Import spreadsheet for MemberSuite
<?php
require_once('setup.inc.php');
require_once('functions.inc.php');
$new_users = array();
$existing_users = array();
// $file = './import-lci/MellonFellowsAllToDate.xlsx';
$file = './import-lci/Mellon_Fellows_never_imported.xlsx';
#!/bin/bash
#Description: Images downloader
#Filename: img_downloader.sh
if [ $# -ne 3 ];
then
echo "Usage: $0 URL -d DIRECTORY"
exit -1
fi
for i in {1..4}
do