Skip to content

Instantly share code, notes, and snippets.

View rpresser's full-sized avatar

Ross Presser rpresser

View GitHub Profile
@rpresser
rpresser / image-1.vec
Created August 6, 2021 14:17
Excerpt from the "VECTORIALIMAGES" file that defines all the lines and boxes in the PDF version of the NYT Crossword from 2021-08-06.
<?xml version="1.0" encoding="utf-8"?>
<!-- Excerpt from the "VECTORIALIMAGES" file that defines
all the lines and boxes in the PDF version of the NYT Crossword from 2021-08-06.
One of the two files generated by pdftoxml on the file Aug0621.pdf -->
<VECTORIALIMAGES>
<!-- This clipping region defines the page size -->
<CLIP sid="p1_s1" x="0" y="0" width="612" height="792" idClipZone="p1_c1">
<GROUP sid="p1_s2" closed="true">
<M x="0" y="792" />
<L x="612" y="792" />
@rpresser
rpresser / Aug0621.xml
Created August 6, 2021 13:54
Part of the xml output from pdftoxml against the NYT crossword PDF download from 2021-08-06
<?xml version="1.0" encoding="utf-8"?>
<!-- This is an excerpt from the output of pdftoxml against the NYT crossword PDF download from 2021-08-06.
-->
<!-- the XML header. Get the page width from PAGE; you can use it to separate clues from boxes.
Note that all PDF coordinates are in points (72 points to the inch). -->
<DOCUMENT>
<METADATA>
<PDFFILENAME>Aug0621.pdf</PDFFILENAME>
<PROCESS name="pdftoxml" cmd="">
<VERSION value="2.0">
<#
.Synopsis
"take in a variable JSON file from a drop target, a web.config, and a web.foo.config transform file and spit out a transformed file with the final substitutions."
.DESCRIPTION
This script is for previewing the common workflow of substituting OctopusDeploy variables within a *.foo.config transform file, then applying that transform file
to a *.config file.
.NOTES
Name: Transform-OctopusConfig
@rpresser
rpresser / gist:71b9ee973c946e21f4b3af653cb21cec
Last active December 19, 2019 20:06
Uniquify Names in a list of objects with a Name property, by appending _2, _3, etc.
class foo
{
public string Name { get; set; }
public string description { get; set; }
}
void Main()
{
List<foo> coll = new List<foo>();
coll.Add(new foo() { Name = "ross", description = "me" });
@rpresser
rpresser / gist:eb63b732932a2e9bcbdd0d7c8c7f9eca
Created December 18, 2019 19:48
Download OctopusDeploy artifacts from a task (C#)
// This is C# code meant for use in LINQPad.
// Add nuget reference to Octopus.Client.
// Provide your OctopusDeploy server URL and APIKEY in environment variables (see the first line below),
// or hardcode them, or whatever you wish.
var endpoint = new OctopusServerEndpoint(Environment.GetEnvironmentVariable("OCTOPUS_SERVER"),Environment.GetEnvironmentVariable("OCTOPUS_CLI_API_KEY"));
var repository = new OctopusRepository(endpoint);
string taskID = "ServerTasks-104598";
var task = repository.Tasks.Get(taskID);