This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.xml.*; | |
import groovy.json.*; | |
def filePath = "/home/ssd/source/repos/spring-petclinic/target/site/jacoco/jacoco.xml" | |
def output = StringBuilder.newInstance() | |
output << "# Code Coverage Report\n" | |
output << "\n" | |
//def file = new File(filePath) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Query Kind="Program"> | |
<Namespace>System.Globalization</Namespace> | |
</Query> | |
void Main() | |
{ | |
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US"); //Separate double digits with dot not comma - please! | |
var data = new[] {22.61, 22.59, 22.63, 22.60, 22.62, 22.58, 22.61, 22.62, 22.60, 22.64, 22.69, 22.62, 22.65, 22.62, 22.61, 22.65, 22.63, 22.61, 22.65, 22.63, 22.59, 22.62, 22.59, 22.64, 22.58, 22.61, 22.63, 22.61, 22.61, 22.69, 22.62, 22.59, 22.65, 22.65, 22.64, 22.63, 22.63, 22.63, 22.59, 22.61, 22.67, 22.57, 22.60, 22.61, 22.61, 22.61, 22.60, 22.61, 22.64, 22.62, 22.63, 22.67, 22.65, 22.65, 22.61, 22.63, 22.63, 22.61, 22.62, 22.69, 22.62, 22.59, 22.59, 22.61, 22.61, 22.58, 22.61, 22.65, 22.61, 22.63, 22.68, 22.62, 22.64, 22.62, 22.62, 22.64, 22.64, 22.63, 22.65, 22.61, 22.60, 22.63, 22.59, 22.62, 22.61, 22.59, 22.63, 22.62, 22.60, 22.69, 22.62, 22.61, 22.63, 22.65, 22.64, 22.63, 22.63, 22.65, 22.58, 22.60}; | |
RenderLineGraph("Time", "P1", data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonSlurper | |
// this was created to turn a swagger openapi json file into a flat file | |
// this flat file can be loaded and parsed into columns in Excel (text to columns > split columns on pipe) | |
// sample json to turn into a file to parse can be found here: http://editor.swagger.io/ | |
def ouput = new File("open-api-output.txt") | |
def inputFile = new File("D:\\Data\\Groovy\\open-api.json") | |
def json = new JsonSlurper().parseText(inputFile.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Query Kind="Program"> | |
<Reference Relative="bin\Newtonsoft.Json.dll">D:\Data\LINQ\bin\Newtonsoft.Json.dll</Reference> | |
</Query> | |
void Main() | |
{ | |
// Note, the code below comes from https://github.com/auth0/auth0-aspnet/ | |
// This is code I was working through when learning how JSON Web Tokens work. | |
// JWT's can be tested using Auth0's excellent website here: https://jwt.io/ | |
// Note: for simplicity I have modified sections of the code, for a full implementation use Auth0's library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Query Kind="Program" /> | |
void Main() | |
{ | |
string mailServer = "<mail server>"; | |
int port = 25; | |
string mailFrom = "<email address>"; | |
string mailTo = "<email address>"; | |
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(mailServer, port); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var files = Directory.EnumerateFiles(@"enter-path-to-files-here", "*.cs", SearchOption.TopDirectoryOnly); | |
foreach (var file in files) | |
{ | |
// hardcoding is bad | |
if (file.Contains("Enum.cs")) continue; | |
ParseFile(File.ReadAllLines(file)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonSlurper | |
def inputFile = new File("open-api.json") | |
def json = new JsonSlurper().parseText(inputFile.text) | |
println "swagger version: ${json.swagger.value}" | |
println "description: ${json.info.description.value}" | |
println "title: ${json.info.title.value}" | |
println "------------------------------------------" | |
println "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string GetStrings() | |
{ | |
return @" | |
${log_lines_here} | |
"; | |
} | |
void Main() | |
{ | |
var list = new List<LogItem>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# note: use $body$ in template for placement | |
pandoc readme.md --template=template.html --css=template.css -f markdown -t html -s -o readme.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Query Kind="Program"> | |
<Reference Relative="bin\Newtonsoft.Json.dll">D:\Data\LINQ\bin\Newtonsoft.Json.dll</Reference> | |
</Query> | |
void Main() | |
{ | |
// ------------------------- | |
// To use this application you must download a copy of Newtonsoft.Json.dll, which by default is not bundled with LINQPad. | |
// This DLL can be sourced from the NuGet package manager here: https://www.nuget.org/packages/Newtonsoft.Json | |
// Note the hardcoded path above, this can be changed to the location of the DLL on your hard drive. |
NewerOlder