Skip to content

Instantly share code, notes, and snippets.

View jdheyburn's full-sized avatar
👋
Heya!

Joseph Heyburn jdheyburn

👋
Heya!
View GitHub Profile
@jdheyburn
jdheyburn / DailySummary.txt
Last active January 5, 2024 09:35
Obsidian journalling templates
<%*
moment.locale("gb")
const thisDay = window.moment(new Date(tp.file.title));
const previousDay = thisDay.clone().subtract(1, 'days');
const previousDayFmt = previousDay.format("YYYY-MM-DD")
const lastYearDay = thisDay.clone().subtract(1, 'years');
const nextDay = thisDay.clone().add(1, 'days');
const nextDayFmt = nextDay.format("YYYY-MM-DD")
const thisWeek = thisDay.format("YYYY-[W]ww")
const thisMonth = thisDay.format("YYYY-MM-[M]")
@jdheyburn
jdheyburn / modify-aws-instance-type.sh
Last active January 6, 2022 11:42
Function to stop AWS instance before changing its instance type, and starting it afterward
# Change AWS instance type by hostname
function modify-aws-instance-type() {
local hostname=$1
if [ -z $hostname ]; then
echo "ERR: hostname not provided, usage:"
echo " modify-aws-instance-type HOSTNAME INSTANCE_TYPE"
return 1
fi
local instance_type=$2
if [ -z $instance_type ]; then
@jdheyburn
jdheyburn / function.tmpl
Created July 16, 2020 21:27
Modified gotest template files allowing for enhanced error testing in Go
{{define "function"}}
{{- $f := .}}
func {{.TestName}}(t *testing.T) {
{{- with .Receiver}}
{{- if .IsStruct}}
{{- if .Fields}}
type fields struct {
{{- range .Fields}}
{{Field .}} {{.Type}}
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
@jdheyburn
jdheyburn / hugo_rss.xml
Last active December 23, 2022 02:52
Modifications made to Hugo's RSS templating XML to produce full content and cards
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
@jdheyburn
jdheyburn / hugo_layouts_posts_li.html
Created April 15, 2020 07:11
A hugo-coder modification to allow emojified titles in type lists
<li>
<span class="date">{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</span>
<a class="title" href="{{ .Params.ExternalLink | default .RelPermalink }}">{{ .Title | emojify }}</a>
</li>
@jdheyburn
jdheyburn / hugo_layouts_posts_single.html
Last active April 14, 2020 07:52
A hugo-coder modification to allow emojified titles and table of contents
{{ define "title" }}
{{ if .Site.Params.enableEmoji }}
{{ .Title | emojify }} · {{ .Site.Title | emojify }}
{{ else }}
{{ .Title }} · {{ .Site.Title }}
{{ end }}
{{ end }}
{{ define "content" }}
<section class="container post">
<article>
name: Build and deploy to jdheyburn.github.io
on:
push:
branches:
- master
schedule:
- cron: "0 10 * * *"
jobs:
dist: xenial
git:
depth: false
env:
global:
- HUGO_VERSION="0.58.3"
matrix:
secure: REDACTED
#!/bin/bash
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
# Copy CNAME to public
cp CNAME ./public/