Skip to content

Instantly share code, notes, and snippets.

Stewart Adam stewartadam

Block or report user

Report or block stewartadam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stewartadam
stewartadam / install-google-chrome.ps1
Last active Jul 22, 2019
Install Google Chrome from PowerShell (i.e. how to avoid IE on Windows Server)
View install-google-chrome.ps1
# Credits to @nicolaigj: https://gist.github.com/kurokikaze/350fe1713591641b3b42#gistcomment-2074156
$Path = $env:TEMP; $Installer = "chrome_installer.exe"; Invoke-WebRequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -Wait; Remove-Item $Path\$Installer
@stewartadam
stewartadam / LICENSE
Last active Jun 29, 2018
Default license to apply for all of my Gists that (1) are not forked and (2) do not have a file named LICENSE
View LICENSE
MIT License
Copyright (c) 2018 Stewart Adam
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@stewartadam
stewartadam / main.py
Last active Nov 1, 2019 — forked from gear11/main.py
Simple Python proxy server based on Flask and Requests with support for GET and POST requests.
View main.py
"""
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 Jul 28, 2019
systemd configuration for containers on boot with docker-compose (via linuxserver.io, among others)
View 00-docker-linuxserver-README.md

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 Apr 4, 2018
Spring Redirect to Azure AD
View StubController.java
@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 Jun 21, 2018
Installing Plex in a systemd-nspawn container
View plex-systemd-nspawn-setup.sh
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 Apr 9, 2017
memcached-multi, a RHEL6 initscript with support for easily managing multiple memcached services
View memcached-multi.init
#! /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 Jan 16, 2017
contour-lines-dataviz
View calc.py
#!/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 Mar 10, 2016
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.
View scs-tutorial-linux-shared-hosting-server.sh
#!/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.
@stewartadam
stewartadam / scs-tutorial-linux-basics.sh
Last active Apr 2, 2019
Script used for the SCS Linux Basics tutorial at Concordia University (2016) - discussion about Linux basics & setting up Wordpress on a CentOS 7 machine
View scs-tutorial-linux-basics.sh
#!/bin/sh
###
### Example usage of common commands
###
# pwd
# ls # it's empty
# cd /var/log # there are some files
###
You can’t perform that action at this time.