Skip to content

Instantly share code, notes, and snippets.

Arthur Attwell arthurattwell

Block or report user

Report or block arthurattwell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arthurattwell
arthurattwell / pdf-to-jpg.bat
Created Mar 25, 2019
Batch file to convert PDFs to JPGs (requires GraphicsMagick and Ghostscript installed)
View pdf-to-jpg.bat
:: pdf-to-jpg.bat
::
:: This batch file converts all the PDF files in a folder to JPGs,
:: and each page is a separate, numbered JPG.
::
:: 1. Make sure GraphicsMagick and Ghostscript are installed and in your PATH.
:: 2. Save this pdf-to-jpg.bat file to the folder alongside the files you want to convert.
:: 3. Double-click pdf-to-jpg.bat.
@arthurattwell
arthurattwell / pandoc-html-md.bat
Last active Apr 1, 2019
Script to convert HTML to markdown with Pandoc
View pandoc-html-md.bat
:: pandoc-html-md.bat
::
:: Don't show these commands to the user
@ECHO off
:: Set the title of the window
TITLE Convert HTML to markdown with Pandoc
:: Select file marker
:selectfile
:: Clear any preexisting filename variables
SET filename=
@arthurattwell
arthurattwell / update-path-osx.md
Created Jan 10, 2019
How to update your PATH in Terminal (OSX)
View update-path-osx.md

Updating your PATH in Terminal (OSX)

Background

When you ask your computer to run a program, it needs to be able to find the program's executable files. The PATH is its 'official' list of places to look.

You can have Terminal add locations to your PATH each time you open it. To set this up, you need to create a 'bash profile' ('bash' being the language that Terminal runs in), which Terminal will read each time it launches. The bash profile can list locations that Terminal adds temporarily to the computer's PATH.

These steps show how to do that, in particular for adding Ruby to your PATH after installing it with Homebrew.

@arthurattwell
arthurattwell / graphicsmagick.sh
Last active Jan 7, 2019 — forked from witooh/graphicsmagick.sh
Install GraphicsMagick on Ubuntu 18.04
View graphicsmagick.sh
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:rwky/graphicsmagick -y
sudo apt update
sudo apt install graphicsmagick -y
@arthurattwell
arthurattwell / ebw-usb-setup.sh
Last active Jan 13, 2019
Script to set up the Electric Book tools on a USB drive running Ubuntu 18.04
View ebw-usb-setup.sh
#!/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
Created Jan 7, 2019
Setting up the Electric Book workflow on Windows
View electric-book-tools-setup-windows.md

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. This is necessary for building search indexes for websites. (And, in older repos to Electric Book template version 0.12, for creating PDFs th

@arthurattwell
arthurattwell / update_git_repos.sh
Last active Dec 17, 2018 — forked from douglas/update_git_repos.sh
Update all git repositories under a base directory
View update_git_repos.sh
#!/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 Dec 10, 2018
Split a markdown file into separate files on YAML frontmatter
View split.sh
#!/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 Oct 17, 2018
Cmder settings and custom clink.lua
View Cmder.xml
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2018-10-17 10:40:04" build="180528">
<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="{cmd::Cmder}"/>
<value name="StartFarFolders" type="hex" data="00"/>
@arthurattwell
arthurattwell / WordcountAll.vba
Last active Jun 28, 2018
Microsoft Office macro for getting the word count of all Word files in a folder
View WordcountAll.vba
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
You can’t perform that action at this time.