Skip to content

Instantly share code, notes, and snippets.

View waynegraham's full-sized avatar

Wayne Graham waynegraham

View GitHub Profile
@waynegraham
waynegraham / translate.rb
Created July 24, 2020 14:27
Arabic Translation vs Transliteration
require 'dotenv'
require 'any_ascii'
require 'aws-sdk-translate'
Dotenv.load
class String
def is_western?
count('a-zA-Z') > 0
@waynegraham
waynegraham / Gemfile
Created July 22, 2020 15:09
Spatial Test
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'colorize'
gem 'geo_names'
gem "geocoder"
@waynegraham
waynegraham / pelagios.json
Last active February 19, 2020 17:14
Pelagios digital map of the Roman Empire for Neatline
{
"Pelagios": [
{
"title": "Pelagios Digital Map of the Roman Empire",
"id": "pelagios",
"type": "XYZ",
"properties": {
"urls": [
"http://pelagios.dme.ait.ac.at/tilesets/imperium/${z}/${x}/${y}.png"
]
@waynegraham
waynegraham / geoserver.conf
Created July 7, 2015 12:54
Geoserver httpd configuration
<VirtualHost *:80>
ServerName geoserver.virginia.edu
DocumentRoot /path/to/a/document/root
ErrorLog logs/error_log
CustomLog logs/access_log common
<Directory /path/to/a/document/root>
# This relaxes Apache security settings.
AllowOverride all
@waynegraham
waynegraham / env.sh
Created November 13, 2019 20:15
ZSH custom env
#! /bin/zsh
# Add commonly used folders to $PATH
export PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
for bindir in $HOME/local/bin $HOME/bin; do
if [ -d $bindir ]; then
PATH=$PATH:${bindir}
fi
done
@waynegraham
waynegraham / password.sh
Last active November 13, 2019 20:14
Password generator in zsh
#! /usr/bin/env zsh
if [ -z "$1" ]
then
length=18
else
length=$1
fi
openssl rand -base64 $length
@waynegraham
waynegraham / instructions.md
Created September 12, 2016 16:08
Migrate Wordpress Site to Multisite
  • Create a dump of the mysql database being migrated (e.g. diglib) with mysqldump or wp-cli
$ cd path/to/wordpress-to-migrate
$ wp export ~/wordpress-`date +%Y-%m-%d`.sql
  • Edit the file to replace the the table prefix with the prefix and id used in the WPMU instance. This is the regex in vim:
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 / 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 / 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"},