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
<# | |
1. Leaf | |
Given a text file of TIF/TIFF filenames, create DZI (Deep Zoom Image) tiles from TIFs | |
and create a mirror directory structure for DZI file outputs. | |
* Handles filenames with entry separators | |
* Ignores TIF older than its DZI mirror unless -force param is used | |
* Requires libvips (https://libvips.github.io/libvips/) | |
.\tif2dzi.ps1 -in c:\dev\abc\extract\extracted\tifs\abc-tifs-1.txt ` |
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
<# | |
1. Leaf | |
Given a text file of TIF/TIFF filenames, create JPGs from TIFs | |
and create a mirror directory structure for JPG file outputs. | |
* Handles filenames with entry separators | |
* Ignores TIF older than its JPG mirror unless -force param is used | |
* Requires imagemagick | |
.\tif2jpg.ps1 -in c:\dev\abc\extract\extracted\tifs\abc-tifs-1.txt ` |
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
<# | |
Peter Tyrrell, Andornot | |
Replaces old sql server name with new in textbase binary *.cbs file. | |
Note: Uses PowerShell Core syntax. See comments for Windows PowerShell. | |
Note: Server names of different lengths corrupt the file. | |
#> | |
param ( |
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
<# | |
Rip Audio CD to mp3 files with VLC. | |
#> | |
param ( | |
[string]$vlc = "c:\program files\videolan\vlc\vlc.exe", | |
[string]$cddrive = "E:", | |
[int]$track = 0 | |
) |
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
<# | |
Modifies regedit to tell all versions of .NET to use strongest available TLS. Global setting. | |
Requires admin privileges. | |
Peter Tyrrell | |
#> | |
# check for admin | |
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
Write-Warning ("You do not have admin privileges. Re-run this script as an administrator.") |
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
<# | |
Sync a local to remote directory in SFTP mode | |
#> | |
param( | |
[Parameter(Mandatory = $false, Position = 0)] | |
[string]$logsrc = "", | |
[Parameter(Mandatory = $true, Position = 1)] | |
[string]$hostname, | |
[Parameter(Mandatory = $true, Position = 2)] |
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
protected void Application_Start() | |
{ | |
// various setup bits here... | |
Config.Current.Pipeline.AuthorizeImage += | |
delegate (IHttpModule sender, HttpContext context, IUrlAuthorizationEventArgs e) | |
{ | |
// only restrict ~/media | |
if (!e.VirtualPath.StartsWith(VirtualPathUtility.ToAbsolute("~/media"))) | |
{ |
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
<# | |
Zip up textbase files in preparation for FTP sync to Andornot. | |
Peter Tyrrell, ptyrrell@andornot.com | |
-textbases c:\path\to\accessions.tba, c:\path\to\descriptions.tba | |
-out c:\path\to\destination | |
#> | |
param ( | |
[string[]] $textbases, |
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
using System.Web.Http; | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
using Andi.MVC.Core; | |
using Andi.MVC.Core.Infrastructure.Globalization; | |
namespace Andi.MVC.Web | |
{ | |
public class MvcApplication : System.Web.HttpApplication | |
{ |
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
public class MediaApiController : ApiController | |
{ | |
public HttpResponseMessage Get(string filepath) | |
{ | |
var path = HostingEnvironment.MapPath($"~/media/{filepath}") ?? string.Empty; | |
var mediaType = MediaTypeHeaderValue.Parse(MimeMapping.GetMimeMapping(filepath)); | |
FileStream stream; | |
try |