Skip to content

Instantly share code, notes, and snippets.

View waynegraham's full-sized avatar

Wayne Graham waynegraham

View GitHub Profile
@waynegraham
waynegraham / repair_hard_drive.md
Last active May 30, 2018 13:23
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
### Keybase proof
I hereby claim:
* I am waynegraham on github.
* I am wsgrah (https://keybase.io/wsgrah) on keybase.
* I have a public key ASB-GVuHEWhWtfPYqQlp1DfVI6NzdUJVBOL08uB1bWKcVgo
To claim this, I am signing this object:
@waynegraham
waynegraham / index.html
Last active May 10, 2017 13:36
Load GeoJSON layer in Leaflet
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Leaflet GeoJSON test</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css"
integrity="sha512-07I2e+7D8p6he1SIM+1twR5TIrhUQn9+I6yjqD53JQjFiMf8EtC93ty0/5vJTZGF8aAocvHYNEDJajGdNx1IsQ=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"
integrity="sha512-A7vV8IFfih/D732iSSKi20u/ooOfj/AGehOKq0f4vLT1Zr2Y+RX7C+w8A1gaSasGtRUZpF/NZgzSAu4/Gc41Lg=="
#!/bin/bash
ls | while read -r FILE
do
mv -v "$FILE" `echo $FILE | tr ' ' '_' | tr -d '[{}(),\!]' | tr -d "\'" | tr '[A-Z]' '[a-z]' | sed 's/_-_/_/g'`
done
for file in ./*.{jpg,png,jpeg,gif}
do
if [[ -f $file ]]; then
<?php
include_once('phpsdk.phar');
include_once('config.php');
$api = new MemberSuite();
$api->accesskeyId = Userconfig::read('AccessKeyId');
$api->associationId = Userconfig::read('AssociationId');
$api->secretaccessId = Userconfig::read('SecretAccessKey');
@waynegraham
waynegraham / iscroll.js
Created March 16, 2017 12:02
Omeka SolrSearch Infinite Scroll
jQuery(document).ready(function() {
jQuery('#solr-nav').hide();
});
jQuery(function($) {
var $container = $('#results');
$container.infinitescroll({
//debug: true,
animate: true,