Skip to content

Instantly share code, notes, and snippets.

View stewartadam's full-sized avatar

Stewart Adam stewartadam

View GitHub Profile
@stewartadam
stewartadam / Nightfall-CLA.md
Created September 18, 2026 20:07
Nightfall Contributor License Agreement v1.0

Nightfall Contributor License Agreement

Version 1.0 — 2026-09-18

1. Parties and contributions

This agreement is between you, the contributor identified by the GitHub account accepting this agreement, and Stewart Adam (the Maintainer) for the Nightfall project at https://github.com/stewartadam/nightfall-lightdesk.

A Contribution is original code, documentation, or other material you intentionally submit for inclusion in Nightfall after accepting this agreement. Material you clearly identify as third-party material is excluded from your grants under this agreement and remains subject to its applicable license.

@stewartadam
stewartadam / !gh-pr-review-shortcut-userscript.md
Last active September 4, 2026 00:57
Add shortcuts for navigating GH PR diffs via Tampermonkey

GitHub PR Review Shortcuts

A Tampermonkey userscript for keyboard-first navigation through GitHub pull-request diffs.

Shortcuts

  • j: move to the next viewport-sized diff segment
  • k: move to the previous viewport-sized diff segment
  • v: toggle the selected file's Viewed state and advance to the next file
  • l: load the selected large diff when GitHub defers it
@stewartadam
stewartadam / macos-network-servicelist.sh
Last active November 9, 2022 08:45
Obtain list of active network services on MacOS
# improvement of answer https://apple.stackexchange.com/a/223446/183406
# fixes issue where multiple services may have the same hardware port (e.g. USB Ethernet)
get_interfaces() {
while read -r line; do
sname="$(echo "$line" | sed -E 's|(.*) \(Hardware Port: (.+), Device: (.+)\)|\1|')"
hname="$(echo "$line" | sed -E 's|(.*) \(Hardware Port: (.+), Device: (.+)\)|\2|')"
sdev="$(echo "$line" | sed -E 's|(.*) \(Hardware Port: (.+), Device: (.+)\)|\3|')"
#echo "Current service: $sname, $sdev, $currentservice"
if [ -n "$sdev" ]; then
ifout="$(ifconfig "$sdev" 2>/dev/null)"
@stewartadam
stewartadam / main.py
Last active August 30, 2026 12:50 — forked from gear11/main.py
Simple Python proxy server based on Flask and Requests with support for GET and POST requests.
"""
A simple proxy server, based on original by gear11:
https://gist.github.com/gear11/8006132
Modified from original to support both GET and POST, status code passthrough, header and form data passthrough.
Usage: http://hostname:port/p/(URL to be proxied, minus protocol)
For example: http://localhost:5000/p/www.google.com
"""
import re
@stewartadam
stewartadam / 00-docker-linuxserver-README.md
Last active October 11, 2022 17:13
systemd configuration for containers on boot with docker-compose (via linuxserver.io, among others)

Overview

This sample is intended for modern Linux systems using systemd (Fedora, Ubuntu, Arch, etc).

Installation

Install the files in this gist, replacing dashes for slashes (e.g. etc-systemd-system-dockercompose.service should be installed to /etc/systemd/system/dockercompose.service) and then run systemctl enable --now dockercompose.service to get things started.

Usage

Any manual docker-compose commands should be run from /srv/appdata/linuxserver so that the values from the .env file are applied properly.

Log files can be viewed by running docker-compose -f --tail=50.

@stewartadam
stewartadam / StubController.java
Last active April 4, 2018 17:59
Spring Redirect to Azure AD
@RestController
class StubController {
@RequestMapping("/resource/{id}")
ModelAndView resource(ModelMap model, HttpServletRequest request, @PathVariable String id) {
model.addAttribute("attribute", "forwardWithForwardPrefix");
String client_id = "";
int state = (int )(Math.random() * 1000000 + 1);
String resource = "client_id_guid_of_fhir";
@stewartadam
stewartadam / plex-systemd-nspawn-setup.sh
Last active June 21, 2018 01:47
Installing Plex in a systemd-nspawn container
CONTAINER_NAME="plex"
CONTAINER_ROOT="/var/lib/machines/$CONTAINER_NAME"
BRIDGE_INTERFACE=br0
mkdir "$CONTAINER_ROOT"
sudo dnf --releasever=25 --installroot="$CONTAINER_ROOT" install systemd passwd dnf fedora-release NetworkManager
systemd-nspawn -D "$CONTAINER_ROOT" --network-bridge="$BRIDGE_INTERFACE"
# Install Plex RPM here, then 'exit' or press Ctrl+] 3x to kill container
mkdir -p /etc/systemd/nspawn
@stewartadam
stewartadam / memcached-multi.init
Created April 9, 2017 07:07
memcached-multi, a RHEL6 initscript with support for easily managing multiple memcached services
#! /bin/bash
#
# chkconfig: - 55 45
# description: The memcached daemon is a network memory cache service.
# processname: memcached
### END INIT INFO
# Based on https://gist.github.com/lboynton/3775818
# Usage:
# cp /etc/sysconfig/memcached /etc/sysconfig/memcached-server1
@stewartadam
stewartadam / calc.py
Created January 16, 2017 08:28
contour-lines-dataviz
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Calculates the x,y co-ordinates of the contour lines given a 2D grid of land
heights, with the origin in the bottom-left corner.
"""
import math
# cheap scope hack
CONTOURS = {}
@stewartadam
stewartadam / scs-tutorial-linux-shared-hosting-server.sh
Created March 10, 2016 04:48
CentOS 7 shared hosting server setup script based on the SCS Shared Linux Hosting Server Security tutorial at Concordia University (2016) - discussion about security principles in the context of a shared hosting server.
#!/bin/sh
#
# Usage:
# This script will establish a basic shared hosting server running DNS, Web (HTTP), DB (SQL) and e-mail (SMTP/IMAP) services.
#
# This script doesn't include usage information on adding new user accounts and setting up mail inboxes; for that, please see my
# CentOS 5 server setup tutorial: http://www.firewing1.com/howtos/servers/centos5/getting_started
#
# This configuration is very similar to my previously documented CentOS 5 server setup, but has been ported to take advantage
# of the new features in CentOS 7.