Skip to content

Instantly share code, notes, and snippets.

View arthurattwell's full-sized avatar

Arthur Attwell arthurattwell

View GitHub Profile
@arthurattwell
arthurattwell / ebw-usb-setup.sh
Last active May 10, 2020 12:44
Script to set up the Electric Book tools on a USB drive running Ubuntu 18.04
#!/bin/bash
# This script sets up the Electric Book tools on an Ubuntu 18.04 USB drive.
# It assumes a fresh Ubuntu 18.04 install. Anywhere else, use at your own risk.
# Tested on a 32GB Sandisk Cruzer Blade drive.
#
# Before using this script, to create a bootable USB drive:
# - On Windows, use Rufus, but changes to the USB will not be saved:
# https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-windows
# - On Ubuntu, optionally with the ability to save ('persistence'), use mkusb:
@arthurattwell
arthurattwell / electric-book-tools-setup-windows.md
Last active September 5, 2022 09:57
Setting up the Electric Book workflow on Windows

Setting up the EBW tools on Windows

These steps have worked for me on several machines. Every machine is a bit different, so your mileage may vary.

On OSX? I've written up guidance for installing the EBW tools on OSX here.

  1. The first steps are to get Ruby and Jekyll installed. I have a whole separate piece on that here. Go and read that, follow it closely, and come back here when you're done.

  2. Download and install PrinceXML. See princexml.com/doc/installing for instructions. Note that this is proprietary software (the only proprietary tool we use). You can try the trial version for free; it adds a watermark to your first page.

  3. Install PhantomJS. [Note: this step is only necessary for Electric Book template v.0.15 and earlier. Phantom is not required from v0.16.0] This is necessary for

@arthurattwell
arthurattwell / update_git_repos.sh
Last active May 10, 2020 12:42 — forked from douglas/update_git_repos.sh
Update all git repositories under a base directory
#!/bin/bash
# store the repos dir
REPOS_DIR=/var/services/homes/admin/EBW/Dropbox/git-repos
# Go into the repos folder
cd $REPOS_DIR
# Let the person running the script know what's going on.
echo "Pulling in latest changes for all repositories..."
@arthurattwell
arthurattwell / split.sh
Last active November 24, 2021 11:52
Split a markdown file into separate files on YAML frontmatter
#!/bin/bash
# That tells Linux to use a Bourne shell interpreter.
# Run this script from the current directory. (Required on OSX.)
cd -- "$(dirname "$0")"
# Don't echo these commands.
set +v
# Get the filename from the user.
@arthurattwell
arthurattwell / Cmder.xml
Last active July 4, 2020 15:35
Cmder settings and custom clink.lua
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2020-07-04 17:34:43" build="161206">
<value name="Language" type="string" data="en"/>
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data=""/>
<value name="StartTasksFile" type="string" data=""/>
<value name="StartTasksName" type="string" data="{Bash::Git bash}"/>
<value name="StartFarFolders" type="hex" data="00"/>
@arthurattwell
arthurattwell / WordcountAll.vba
Last active June 28, 2018 14:21
Microsoft Office macro for getting the word count of all Word files in a folder
Sub WordcountAll()
' Add the path to the folder you are counting below in quotes where you see C:\
' Adapted from https://www.datanumen.com/blogs/2-quick-ways-count-total-number-pages-words-multiple-word-documents/
Dim objWordApplication As Word.Application
Dim nPageNumber As Long
Dim nWordNumber As Long
Dim objFile As Variant
Dim objFileSystem As Object
Dim objFolders As Object
@arthurattwell
arthurattwell / .htaccess
Created June 18, 2018 14:24
Send all traffic to non-www https
# Send www to non-www (thanks http://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
@arthurattwell
arthurattwell / README_live-deploy.md
Created June 4, 2018 15:54
Template readme for Electric Book live builds
layout
min

Deploying this build to a live server

@arthurattwell
arthurattwell / epubcheck-all.bat
Created May 10, 2018 18:58
Batch file for validating all the epubs in a folder with EpubCheck
:: Don't show these commands to the user
@echo off
:: Keep variables local, and expand at execution time not parse time
setlocal enabledelayedexpansion
:: Set the title of the window
title Validating epubs
:begin
echo This will run EpubCheck on all the epubs in this folder.
pause
@arthurattwell
arthurattwell / translation-characters.txt
Last active May 30, 2018 11:28
A list of non-ASCII characters/glyphs useful for testing font choices in translation projects
ḓ Ḓ ḽ ṋ ṱ Ṱ µ » ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ ƒ Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς σ τ υ φ χ ψ ω ϑ ϒ ϖ Œ œ Š š Ÿ