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
// Blank ImageJ Macro Script that loops through files in a directory | |
// Written by Adam Dimech | |
// Also available at https://gist.github.com/AdamDimech/cd3999f6fe9eddfa55c19d6fd3997bbc | |
// Specify global variables | |
input = getDirectory("Input Directory"); | |
output = input; // Output images to the same directory as input (prevents second dialogue box, otherwise getDirectory("Output Directory")) | |
Dialog.create("File Type"); | |
Dialog.addString("File Suffix: ", ".png", 5); |
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
// ImageJ Macro Code | |
// Output timestamp in format EEE dd MMM yyyy, hh:mm:ss | |
MonthNames = newArray("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); | |
DayNames = newArray("Sun", "Mon","Tue","Wed","Thu","Fri","Sat"); | |
getDateAndTime(year, month, dayOfWeek, dayOfMonth, hour, minute, second, msec); | |
print (DayNames[dayOfWeek], dayOfMonth, MonthNames[month], year + "," + hour + ":" + minute + ":" + second); |
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
# UNC File Path Finder | |
# Written by Adam Dimech | |
# Based on https://code.adonline.id.au/unc-path-from-local-path-in-powershell/ | |
# 1 March 2017 | |
Add-Type -AssemblyName System.Windows.Forms | |
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{ | |
Multiselect = $false # Only one file can be chosen | |
InitialDirectory = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"; #Opens in My Computer | |
Filter = 'All File Types|*.*' # Specified file types |
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
$Drive = $(get-location).Path | |
$x = new-object system.io.driveinfo($Drive) | |
$x.drivetype | Out-Null | |
If ($x.drivetype -eq "Fixed") { | |
Write-Host "`r`n`r`nSorry," $Drive "is not a networked drive." | |
} | |
Else { | |
$currentDirectory = Get-Location | |
$currentDrive = Split-Path -qualifier $currentDirectory.Path |
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
$currentDirectory = Get-Location | |
$currentDrive = Split-Path -qualifier $currentDirectory.Path | |
$logicalDisk = Gwmi Win32_LogicalDisk -filter "DriveType = 4 AND DeviceID = '$currentDrive'" | |
$unc = $currentDirectory.Path.Replace($currentDrive, $logicalDisk.ProviderName) | |
$output = "`r`n`r`nThe UNC Path for " + $currentDirectory + " is " + $unc | |
$output |
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
# More information at https://code.adonline.id.au/download-all-pdfs-from-a-web-page/ | |
function Grab-PDFs { | |
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null | |
[System.Windows.Forms.Application]::EnableVisualStyles() | |
$browse = New-Object System.Windows.Forms.FolderBrowserDialog | |
$browse.SelectedPath = "C:\" | |
$browse.ShowNewFolderButton = $false | |
$browse.Description = "Select a directory" |
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
#Upload files to an SFTP server via PowerShell | |
#Requires WinSCP to be installed on local machine | |
# Load WinSCP .NET assembly | |
Add-Type -Path "C:\path\to\WinSCPnet.dll" | |
# Password prompt (not obscured) | |
[void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | |
$title = 'Credentials' |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
package TidyUnzipper; | |
use strict; | |
use Archive::Zip qw(:ERROR_CODES :CONSTANTS); | |
use Exporter 'import'; |
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
Sub StripTimeFromDate() | |
Dim DateTime As Long, i As Long | |
DateTime = Range("D" & Rows.Count).End(xlUp).Row | |
For i = 2 To DateTime | |
With Range("D" & i) | |
.NumberFormat = "dd/mm/yy" | |
.Value = DateValue(.Value) | |
End With | |
Next i | |
End Sub |
NewerOlder