Skip to content

Instantly share code, notes, and snippets.

View jakejarvis's full-sized avatar

Jake Jarvis jakejarvis

View GitHub Profile
#!/usr/bin/env bash
#_____________________________________________________________________________
# Git Nowhere
#-----------------------------------------------------------------------------
#
# Use: Run as "$ . ./gitdate" before "$ git commit" to manually set
# the date to UTC in order to obscure timezone-based geodata tracking.
#
# If you would always like your timestamps to be obscured for a specific
# project, then you'll need to either source this file BEFORE EACH COMMIT
@jakejarvis
jakejarvis / wp-su.sh
Created September 16, 2019 03:22
wp-su.sh
#!/bin/sh
# This is a wrapper so that wp-cli can run as the www-data user so that permissions
# remain correct
sudo -E -u www-data /bin/wp-cli.phar $*
@jakejarvis
jakejarvis / tor.sh
Created October 1, 2019 00:16
system-wide Tor proxy on macOS
#!/usr/bin/env bash
#
# ######################################################################
# Start Tor and switch the system-wide proxy settings in macOS
# ----------------------------------------------------------------------
# Usage:
# `./tor.sh` in Terminal, kill with ctrl + c
# ----------------------------------------------------------------------
# Source:
# https://kremalicious.com/simple-tor-setup-on-mac-os-x/
@jakejarvis
jakejarvis / Dockerfile
Last active October 6, 2019 18:05
custom base image for Hugo build at https://jarv.is
FROM golang:1.12-alpine AS builder
ARG HUGO_REPO=https://github.com/jakejarvis/hugo.git
ARG HUGO_BRANCH=noopener
# ARG HUGO_COMMIT=a28865c
ARG HUGO_BUILD_TAGS=extended
# CGO (and gcc/g++) required to build wellington/go-libsass
ARG CGO=1
ENV CGO_ENABLED=${CGO}
@jakejarvis
jakejarvis / gh-registry.yml
Created October 9, 2019 00:21
native github action to push to github package registry
name: Push to GitHub Package Registry
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
@jakejarvis
jakejarvis / esxi-update-via-customizer.ps1
Last active October 14, 2019 23:03
manual esxi patching
# https://www.v-front.de/p/esxi-customizer-ps.html
# https://vibsdepot.v-front.de/wiki/index.php/Net51-drivers#Description
Install-Module -Name VMware.PowerCLI -AllowClobber
.\ESXi-Customizer-PS-v2.6.0.ps1 -v67 -vft -load net55-r8168,net51-r8169
# ...or:
@jakejarvis
jakejarvis / image.html
Created October 30, 2019 01:00
Hugo shortcode for resizing retina images with max-width
<!-- Automatic resizing for HiDPI/retina images -->
<!-- https://gohugo.io/content-management/image-processing/ -->
{{- $original := .Page.Resources.GetMatch (.Get "src") -}}
{{- .Scratch.Set "image" $original -}}
{{- $maxWidth := 910 -}}
{{- if .Get "width" }}
{{- $inputWidth := (int (.Get "width")) -}}
@jakejarvis
jakejarvis / config.toml
Created October 31, 2019 01:02
hugo netlify _redirects _headers files
# add redirects/headers
[outputs]
home = ["HTML", "RSS", "REDIRECTS", "HEADERS"]
# remove .{ext} from text/netlify
[mediaTypes."text/netlify"]
suffixes = [""]
delimiter = ""
@jakejarvis
jakejarvis / cloudflare-ufw.sh
Created December 6, 2019 04:35
UFW rule updater to only allow HTTP and HTTPS traffic from Cloudflare IP address ranges
#!/bin/sh
#
# UFW rule updater to only allow HTTP and HTTPS traffic from Cloudflare IP addresses.
# Inspired by https://github.com/Paul-Reed/cloudflare-ufw/blob/master/cloudflare-ufw.sh
#
# To run as a daily cron job:
# 1. sudo crontab -e
# 2. Add this line to the end:
# @daily /this/file/location/cloudflare-ufw.sh &> /dev/null