Skip to content

Instantly share code, notes, and snippets.

View GRArmstrong's full-sized avatar

Graham R. Armstrong GRArmstrong

  • North East England, UK
View GitHub Profile
@GRArmstrong
GRArmstrong / Main.sublime-menu
Created August 21, 2013 11:06
I came across this really useful snippet of code from http://www.bergspot.com/blog/2012/05/formatting-xml-in-sublime-text-2-xmllint/ to format XML data using the xmllint command. I've modified it to iron out bugs I had using it with Sublime Text 3 (Build 3047). To add it to Sublime, place this tidy_xml_lint.py file in your Sublime install's Pack…
[
{
"caption": "Selection",
"children": [
{
"caption": "Format",
"children": [
{
"caption": "Tidy with XML Lint",
"command": "tidy_xml_lint"
@GRArmstrong
GRArmstrong / html_tester.html
Created November 29, 2013 18:56
A script I created to try out HTML scraps. Paste HTML into the text field and it renders below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>XHTML Tester</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style media="screen" type="text/css">
body {
font-family: sans-serif;
font-size: 1.1em;
@GRArmstrong
GRArmstrong / .gitconfig
Last active October 23, 2019 13:35
Git configuration, with so many aliases!
[user]
name = Graham R. Armstrong
email = ### EMAIL ADDRESS HERE OBVS ###
[core]
autocrlf = input
editor = atom -w
[push]
default = simple
[color]
diff = auto
@GRArmstrong
GRArmstrong / git-remove-ignored-files.sh
Created October 30, 2017 15:34
Clear out incorrect committed files from Git, matching extensions defined in .gitignore
git ls-files --ignored --exclude-standard | while read line; do git rm "$line"; done
@GRArmstrong
GRArmstrong / pwd_display.sh
Created July 13, 2018 11:48
Modified pwd script with custom colours.
# This function from: https://wiki.archlinux.org/index.php/Color_Bash_Prompt_%28%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%29#Wolfman.27s
##################################################
# Fancy PWD display function
##################################################
# The home directory (HOME) is replaced with a ~
# The last pwdmaxlen characters of the PWD are displayed
# Leading partial directory names are striped off
# /home/me/stuff -> ~/stuff if USER=me
# /usr/share/big_dir_name -> ../share/big_dir_name if pwdmaxlen=20
##################################################
# ls Aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Work-On Alias
alias wo="cd /home/`whoami`/''"
# reset GNOME when it drops dead
@GRArmstrong
GRArmstrong / make_backup_fstab.py
Created March 15, 2021 21:56
Generates fstab entries for a FreeBSD/TrueNAS jail of all available ZFS datasets (excluding 'boot-pool', '.system', and live 'iocage') so that a backup program in a jail (e.g. duplicati) can access the data and back it all up.
#!/usr/local/bin/python
"""
make_backup_fstab.py
2021-03-15 by Graham R. Armstrong
Generates fstab entries for a FreeBSD/TrueNAS jail of all available ZFS
datasets (excluding 'boot-pool', '.system', and live 'iocage') so that
a backup program in a jail (e.g. duplicati) can access the data and back
it all up.