Skip to content

Instantly share code, notes, and snippets.

View lukehollis's full-sized avatar

Luke Hollis lukehollis

View GitHub Profile
-----BEGIN WEBFACTION INSTALL SCRIPT-----
#!/bin/env python2.7
"""
This creates an Apache Tomcat server version 7.0.63.
The front-end web server proxies incoming requests to the Tomcat server
listening on an unprivileged port.
The installer disables the AJP protocol, as well as the network port Tomcat
@lukehollis
lukehollis / entities.json
Created March 4, 2020 00:36
List of named entities in Vergil + metadata from dbpedia retrieved ~2016
[{
"_id": {
"$oid": "54bd5a48b7efdad76ec454f8"
},
"en_name": "acestes",
"desc": "In Roman mythology, Acestes or Egestes (Greek Ἄκέστης) was the son of the Sicilian river-god Crinisus by a Dardanian or Trojan woman named Egesta or Segesta.[1]",
"link": "http://en.wikipedia.org/wiki/Acestes",
"thumbnail": "",
"works": ["aeneid"],
"slug": "acestes"
@lukehollis
lukehollis / ingest.py
Created June 1, 2017 01:39
Ingest cltk formatted json files into the cltk archive mongo database
import os
import json
import pdb
import datetime
import pymongo
import six
import re
import unicodedata
import concurrent.futures
from concurrent.futures import ProcessPoolExecutor, wait, as_completed
@lukehollis
lukehollis / DraftEditorInput.js
Created June 1, 2017 01:32
Draft Editor Input Component
import { HOC as formsyHOC } from 'formsy-react'; // eslint-disable-line import/no-unresolved
import stylePropType from 'react-style-proptype'; // eslint-disable-line import/no-unresolved
import reactCSS from 'reactcss';
import { EditorState, convertToRaw, convertFromRaw, convertFromHTML, ContentState } from 'draft-js'; // eslint-disable-line import/no-unresolved
import Editor from 'draft-js-plugins-editor'; // eslint-disable-line import/no-unresolved
import createInlineToolbarPlugin, { Separator } from 'draft-js-inline-toolbar-plugin'; // eslint-disable-line import/no-unresolved
import { stateToHTML } from 'draft-js-export-html';
import {
ItalicButton,
BoldButton,
@lukehollis
lukehollis / settings.json
Created April 28, 2017 20:33
settings.json
{
"environment": "development",
"public": {
"ga": {
"id": "UA-XXXXXXX-XX"
},
"loginState": {
"domain": ".orphe.us",
"cookieName": "archimedes-digital-app"
},
@lukehollis
lukehollis / gist:28e369dc7186a5e4ce0aa9d809248292
Created March 29, 2017 22:51 — forked from adammeghji/gist:5637522
Convert a PostgreSQL database from SQL_ASCII to UTF8 encoding
# convert createdb's template to UTF8
echo "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';" | psql -U postgres
echo "drop database template1;" | psql -U postgres
echo "create database template1 with template = template0 encoding = 'UTF8';" | psql -U postgres
echo "update pg_database set datacl='{=c/postgres,postgres=CTc/postgres}' where datname='template1';" | psql -U postgres
echo "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';" | psql -U postgres
# export and reimport as UTF8
pg_dump -U uniiverse --encoding utf8 mydatabase -f mydatabase_utf8.sql
createdb -U postgres -E utf8 mydatabase_utf8
@lukehollis
lukehollis / gist:6e49f833416706f24b8387c6b74ddd9c
Created March 29, 2017 22:51 — forked from adammeghji/gist:5637522
Convert a PostgreSQL database from SQL_ASCII to UTF8 encoding
# convert createdb's template to UTF8
echo "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';" | psql -U postgres
echo "drop database template1;" | psql -U postgres
echo "create database template1 with template = template0 encoding = 'UTF8';" | psql -U postgres
echo "update pg_database set datacl='{=c/postgres,postgres=CTc/postgres}' where datname='template1';" | psql -U postgres
echo "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';" | psql -U postgres
# export and reimport as UTF8
pg_dump -U uniiverse --encoding utf8 mydatabase -f mydatabase_utf8.sql
createdb -U postgres -E utf8 mydatabase_utf8
@lukehollis
lukehollis / functions.php
Created March 8, 2017 21:18
ACF Sponsorship Ad Spots
if(function_exists("register_field_group"))
{
register_field_group(array (
'id' => 'acf_sponsor-ads',
'title' => 'Sponsor Ads',
'fields' => array (
array (
'key' => 'field_58c0739e3a351',
'label' => 'sponsorship_ad_image',
'name' => 'sponsorship_ad_image',
{"sentence_lengths": [52, 22, 5, 49, 23, 3, 24, 17, 25, 31, 11, 3, 17, 25, 30, 16, 17, 21, 17, 29, 9, 28, 15, 33, 3, 12, 21, 10, 13, 23, 7, 14, 13, 5, 10, 57, 14, 14, 15, 37, 17, 20, 15, 27, 25, 19, 9, 7, 14, 6, 7, 7, 11, 18, 15, 25, 66, 13, 5, 17, 29, 15, 12, 25, 20, 20, 27, 21, 50, 8, 19, 16, 14, 6, 6, 20, 6, 14, 28, 14, 28, 23, 28, 15, 33, 26, 20, 6, 33, 22, 19, 3, 5, 18, 3, 23, 41, 33, 20, 19, 12, 25, 2, 17, 17, 13, 42, 24, 12, 22, 61, 27, 21, 26, 8, 12, 10, 6, 22, 12, 8, 2, 18, 13, 8, 10, 21, 11, 5, 29, 26, 19, 7, 18, 8, 24, 13, 10, 20, 21, 16, 9, 20, 10, 10, 13, 30, 26, 29, 9, 23, 9, 9, 12, 7, 28, 22, 6, 13, 12, 20, 26, 39, 7, 12, 14, 35, 25, 20, 44, 16, 15, 9, 14, 19, 32, 35, 25, 12, 23, 13, 23, 25, 28, 5, 14, 13, 14, 26, 19, 26, 13, 34, 22, 25, 3, 29, 4, 8, 10, 14, 15, 22, 13, 12, 44, 7, 6, 6, 14, 15, 15, 20, 22, 27, 14, 4, 7, 7, 13, 15, 27, 14, 9, 10, 42, 20, 6, 5, 27, 17, 14, 9, 5, 14, 25, 15, 14, 7, 13, 6, 13, 23, 12, 27, 28, 34, 20, 7, 42, 6, 22, 19, 20, 21, 8, 20, 21, 42, 13, 27, 14, 13, 13, 13,
This file has been truncated, but you can view the full file.
[
{
"author": "Q. Horatius Flaccus (Horace)",
"language": "latin",
"sentence_lengths": [
37,
41,
36,
19,
18,