Skip to content

Instantly share code, notes, and snippets.

View arthurattwell's full-sized avatar

Arthur Attwell arthurattwell

View GitHub Profile
@arthurattwell
arthurattwell / trigger-gh-pages-build.sh
Last active September 4, 2020 02:32
Trigger a GitHub Pages rebuild
#!/bin/bash
# This script will trigger a rebuild on a repo's GitHub Pages site,
# without having to create a new commit.
# To use this script:
# 1. Save this script to an easilyt accessible place, where you'll run it.
# 2. Create a personal access token on GitHub. In Your profile > Settings
# > Developer settings > Personal access tokens
# 3. Save the token in a text file. Idealy, alongside the script as token.txt
# 4. Run the script from the Terminal with ./trigger-gh-pages-build.sh
@arthurattwell
arthurattwell / deploy.bat
Last active July 27, 2020 10:24
FTP deploy from Windows
:: 1. Create a file called secrets.ftp beside this one.
:: 2. Do not commit secrets.ftp to version control.
:: 3. Copy these lines (without the ::s) to it,
:: and add your server IP address, FTP username and FTP password:
:: open 54.454.4.47
:: ftpusernamehere
:: ftppasswordhere
:: cd public_html
:: lcd public
@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 / _Jekyll-deploy-with-CodeShip-Basic.md
Last active June 30, 2020 15:27
Test and deploy a Jekyll site with CodeShip Basic

Test and deploy a Jekyll site with CodeShip Basic

This gist has been moved to a full repo for better version control and collaboration.

@arthurattwell
arthurattwell / windows-terminal-tips.md
Created May 21, 2020 11:11
Using Windows Terminal

Using Windows Terminal

I've just started using Windows Terminal. Here are tips and settings I'm picking up along the way.

Set default shell

By default WT opens Powershell. I want CMD. Here's how to switch.

@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 / 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 / singular-restricted.php
Created April 23, 2020 13:10
Sample template-part for Electric Book WP restricted pages
<?php
/**
* The template for displaying single posts and pages,
* adapted as an Electric Book WP page for the Twenty Twenty theme
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage Twenty_Twenty
* @since Twenty Twenty 1.0
@arthurattwell
arthurattwell / create-files-list.md
Last active January 21, 2020 12:23
Create a files.txt list for an Electric Book project's update folder

Create a files.txt list

Windows

dir /a-D /S /B > files.txt

  • To remove .git folder, replace: ^\.git\\.*\n
  • To remove sass-cache, replace: ^\.sass-cache\\.*\n
  • To remove node_modules, replace: ^node_modules\\.*\n
  • To remove _site folder, replace: ^_site\\.*\n
@arthurattwell
arthurattwell / terminal-prompt.sh
Last active December 5, 2019 16:14
Set the Terminal prompt in Ubuntu
# Set the Terminal prompt in Ubuntu to:
# user directory (git-branch) $
# Add the lines below to your ~/.bashrc file.
## Get Git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
## Simplify prompt and add Git branch