Skip to content

Instantly share code, notes, and snippets.

@craigmccauley
craigmccauley / HtmlRenderer.cs
Created December 3, 2022 18:37
Renders Blazor Components and Razor Views into HTML
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
@craigmccauley
craigmccauley / ConvertFrom-MarkdownTemplate.ps1
Last active July 17, 2023 16:13
Mermaid diagrams in ADO workaround
# This script file regenerates all the generated markdown files.
# This is needed because Azure DevOps (ADO) does not support mermaid charts
# in the preview pane. Once ADO supports this functionality, remove
# this script, delete the generated files, move and rename the template
# files, and update the links that are going to the generated files.
# Requires a directory structure like so
# |- docs
# |- scripts
# |- ConvertFrom-MarkdownTemplate.ps1
# |- templates
using System;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace McCauley.Util.Services
{
public interface IPasswordPwnedService
@craigmccauley
craigmccauley / MergePdfs.bat
Created October 26, 2020 15:22
Merges all PDF files in the current directory into a merged.pdf file. Requires pdfmerge to be installed https://github.com/metaist/pdfmerge/blob/master/releases/pdfmerge-latest-setup.exe
@echo off
SETLOCAL EnableDelayedExpansion
set command=pdfmerge
for /r %%i in (*.pdf) do (
set command=!command! "%%i"
)
set command=!command! -o merged.pdf
@echo !command! >> temp.bat
call temp.bat
@craigmccauley
craigmccauley / QueryMISTIC.bat
Created October 17, 2020 13:53
Batch file for querying the MISTIC dataset
@echo off
set /p chrom="Enter chromosome: "
set /p pos="Enter position: "
echo.
echo Searching for
echo Chromosome: %chrom% Position: %pos%
"C:\Program Files (x86)\Log Parser 2.2\LogParser.exe" -i:TSV -nSkipLines:1 -e:1 -dtlines:0 "SELECT #CHROM, POS, REF, ALT, MISTIC_score, MISTIC_pred FROM './MISTIC_GRCh37.tsv' WHERE #CHROM = '%chrom%' AND POS = '%pos%'"
////////////////////
//Runs plot profile and copies the first dataset
////////////////////
//clear buffer for working with
String.resetBuffer();
//get plot values
var profile = getProfile();
//macro "Penguin Action Tool - C800C080C880C008C808C088CcccD1bD41D48D50D53D63D72D73D75D82D85D8fD93Da0Da3Db1Db8DebCcdcD0aD3dD55D56D6eD7fD9eDa5Da6DcdDfaCacfC420C620C820Ca20Cc20Ce20C040C240C440C640C840Ca40Cc40Ce40C060C260C460C660C860Ca60Cc60Ce60C080C280C480C680C880Ca80Cc80Ce80C0a0C2a0C4a0C6a0C8a0Caa0Cca0Cea0C0c0C2c0C4c0C6c0C8c0Cac0Ccc0Cec0C0e0C2e0C4e0C6e0C8e0Cae0Cce0Cee0C004C204C404C604C804Ca04Cc04Ce04C024C224D1aD38D39D3aD3bD45D46Db5Db6Dc8Dc9DcaDcbDeaC424C624C824Ca24Cc24Ce24C044C244D19D27D28D36D37D70D80Dc6Dc7Dd7Dd8De9C444D29D44D51D60D71D81D90Da1Db4Dd9C644C844Ca44Cc44Ce44C064C264C464C664D3cD42Db2DccC864Ca64Cc64Ce64C084C284C484C684C884Ca84Cc84Ce84C0a4C2a4C4a4C6a4C8a4Caa4Cca4Cea4D4fD5fD74D84D9fDafDbfC0c4C2c4C4c4C6c4C8c4Cac4Ccc4Cec4C0e4C2e4C4e4C6e4C8e4Cae4Cce4Cee4C008C208C408C608C808Ca08Cc08Ce08C028C228C428C628C828Ca28Cc28Ce28C048C248C448C648C848Ca48Cc48Ce48C068C268C468C668D43D4dD61D91Db3DbdC868Ca68Cc68Ce68C088C288C488C688C888D18D47D5eDaeDb7De8Ca88Cc88Ce88C0a8C2a8C4a8C6a8C8a8Caa8Cca8Cea8D3fD4eD6fDbeC0c8C2c8C4c8C6c8C
@craigmccauley
craigmccauley / 40X40BoxOnCursor.ijm
Created January 25, 2020 09:50
ImageJ 40 by 40 box on cursor location
//make rectange 40 by 40 on cursor location
//get location of cursor
var cursorX, cursorY, cursorZ, buttonFlags;
getCursorLoc(cursorX, cursorY, cursorZ, buttonFlags);
//set rectange vars
var rectangleWidth = 40;
var rectangleHeight = 40;
var rectangleX = cursorX - (rectangleWidth / 2);
@craigmccauley
craigmccauley / BoxMeasure.ijm
Last active September 11, 2019 18:21
ImageJ Measure , increase size of box, measure again
//capture image
//resize + 1 on all sides
//capture image
run("Measure");
var rectangleX, rectangleY, rectangleWidth, rectangleHeight;
getSelectionBounds(rectangleX, rectangleY, rectangleWidth, rectangleHeight);
rectangleX -= 1;
rectangleY -= 1;
rectangleWidth += 2;
rectangleHeight +=2;
@craigmccauley
craigmccauley / 40X40Box.ijm
Created September 11, 2019 18:19
ImageJ 40 by 40 box
//make rectange 40 by 40 in center of image
//get dimensions of image
var imageWidth, imageHeight, channels, slices, frames;
getDimensions(imageWidth, imageHeight, channels, slices, frames);
//set rectange vars
var rectangleWidth = 40;
var rectangleHeight = 40;
var rectangleX = (imageWidth - rectangleWidth)/ 2;