View tif2dzi.ps1
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 ` |
View replace-server-in-cbs.ps1
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 ( |
View force-latest-tls.ps1
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.") |
View sftp-dir-to-remote.ps1
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)] |
View Global.asax.cs
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"))) | |
{ |
View Global.asax.cs
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 | |
{ |
View MediaApiController.cs
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 |
View helper.logging.ps1
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
<# | |
Logging functions. | |
#> | |
function logError([string]$logsrc, [string]$msg) { | |
if ([String]::IsNullOrWhiteSpace($logsrc)) { | |
write-log -msg $msg -level "ERROR" | |
} | |
elseif (@(".txt", ".log").Contains([System.IO.Path]::GetExtension($logsrc)) -eq $true) { | |
write-log -msg $msg -level "ERROR" -file $logsrc |
View zipline.ps1
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, |
View archive-project.ps1
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
param ( | |
[Parameter(Mandatory = $true)] | |
[string]$in, | |
[string]$out = "d:\dev-archive" | |
) | |
$extract_output_dir = "$in\extract\extracted\output\*" | |
remove-item $extract_output_dir -Recurse | |
Write-Host "Removed $extract_output_dir" |
NewerOlder