Skip to content

Instantly share code, notes, and snippets.

View agc93's full-sized avatar
:shipit:

Alistair Chapman agc93

:shipit:
View GitHub Profile
@agc93
agc93 / translations.ts
Last active June 2, 2020 09:39
Extension-specific translation overrides for Vortex: don't do this
import * as path from 'path';
import { fs, log } from "vortex-api";
import { IExtensionApi } from "vortex-api/lib/types/api";
type TranslationLanguage = {code: string, content: string};
/**
* Loads extension-specific translation files directly into `i18next`
*
@agc93
agc93 / csharp.json
Created April 12, 2019 01:55
Strongly Typed ID snippet file for VS Code
{
"strongly-typed-id": {
"prefix": "typedid",
"scope": "csharp",
"body": [
"[JsonConverter(typeof(${1:TypedId}JsonConverter))]",
" [TypeConverter(typeof(${1:TypedId}TypeConverter))]",
" public readonly struct ${1:TypedId} : IComparable<${1:TypedId}>, IEquatable<${1:TypedId}>",
" {",
" public Guid Value { get; }",
@agc93
agc93 / demo.sh
Created October 9, 2017 00:22
Script used for demos and live coding
# This is pretty trimmed down, but is the basic idea, at least
docker ps -a -q -f status=exited | xargs -r docker rm
git reset --hard
git checkout stage-$1
@agc93
agc93 / CakePatternMatcher.cs
Created September 27, 2017 00:13
An experimental alternative approach to the Cake Downlink plugin intended to be more generalised
public bool Match(Path path, VersionSpec version)
{
var platform = GetPlatform(version);
_logger.LogTrace("Invoking Cake matcher for '{0}' (inferred '{1}' platform); matching against '{2}'", version.Summary, platform, path.ToString());
var name = path.GetFilenameWithoutExtension();
return name.Contains($"Cake-{platform}") && name.Contains($"-{version}");
}
private string GetPlatform(VersionSpec version) {
var minor = int.Parse(version.ToString().TrimStart('v').Split('.')[1]);
@agc93
agc93 / docker-compose.yml
Created August 28, 2017 01:20
Running a Ghost blog with MariaDB behind nginx with Docker Compose
version: '2'
services:
proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- '80:80'
- '443:443'
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
@agc93
agc93 / Controller.cs
Created August 2, 2017 06:28
Runtime route prefixing
[Route("{prefix?}")]
public class ApiController : Controller {}
@agc93
agc93 / docker-compose.yml
Created July 12, 2017 07:07
Named volumes at host path
# dev.yml
services:
# trimmed
nginx:
# trimmed
volumes:
- shared:/path/in/container
volumes:
@agc93
agc93 / project.sln
Created May 10, 2017 05:17
blank solution
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@agc93
agc93 / docker-compose.yml
Created April 27, 2017 03:00
Set external network as default in Compose
networks:
default:
external:
name: nginx-proxy
@agc93
agc93 / match-volumes.sh
Created March 20, 2017 00:32
Matching Docker volumes to containers
#!/usr/bin/env bash
for i in $(docker ps -q);do
echo "Container $i"
docker inspect -f '{{ json .Mounts }}' $i | python -m json.tool
echo "-------------------"
done