mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-11 04:29:19 +02:00
Fix syntax errors
This commit is contained in:
parent
9ed577c0d8
commit
fb208f3814
@ -1,4 +1,4 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Converts .DOCX file(s) into Markdown
|
Converts .DOCX file(s) into Markdown
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
@ -27,7 +27,7 @@ try {
|
|||||||
Write-Host "⏳ Converting..."
|
Write-Host "⏳ Converting..."
|
||||||
gci -r -i $FilePattern | foreach {
|
gci -r -i $FilePattern | foreach {
|
||||||
$TargetPath = $_.directoryname + "\" + $_.basename + ".md"
|
$TargetPath = $_.directoryname + "\" + $_.basename + ".md"
|
||||||
pandoc -f docx -s $_.name -o $TargetPath
|
& pandoc -f docx -s $_.name -o $TargetPath
|
||||||
}
|
}
|
||||||
|
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
gci -r -i *.md |foreach{$docx=$_.directoryname+"\"+$_.basename+".docx";pandoc -f markdown -s --citeproc $_.name -o $docx}
|
gci -r -i *.md |foreach{$docx=$_.directoryname+"\"+$_.basename+".docx";pandoc -f markdown -s --citeproc $_.name -o $docx}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Converts Markdown file(s) into HTML
|
Converts Markdown file(s) into HTML
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
param([string]$file = "")
|
param([string]$file = "")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($file -eq "" ) { $file = read-host "Enter path to file" }
|
if ($file -eq "" ) { $file = Read-Host "Enter path to file" }
|
||||||
|
|
||||||
$Result = get-filehash $file -algorithm MD5
|
$Result = Get-Filehash $file -algorithm MD5
|
||||||
|
|
||||||
"✔️ MD5 hash is" $Result.Hash
|
"✔️ MD5 hash is $($Result.Hash)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -20,7 +20,7 @@ try {
|
|||||||
|
|
||||||
$Result = get-filehash $file -algorithm SHA1
|
$Result = get-filehash $file -algorithm SHA1
|
||||||
|
|
||||||
"✔️ SHA1 hash is" $Result.Hash
|
"✔️ SHA1 hash is $($Result.Hash)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -20,7 +20,7 @@ try {
|
|||||||
|
|
||||||
$Result = get-filehash $file -algorithm SHA256
|
$Result = get-filehash $file -algorithm SHA256
|
||||||
|
|
||||||
"✔️ SHA256 hash is:" $Result.Hash
|
"✔️ SHA256 hash is: $($Result.Hash)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([string]$symlink = "", $[string]target = "")
|
param([string]$symlink = "", [string]$target = "")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($symlink -eq "" ) { $symlink = read-host "Enter new symlink filename" }
|
if ($symlink -eq "" ) { $symlink = read-host "Enter new symlink filename" }
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([string]$TargetIP = "", [int]$TargetPort = 0, $[string]Message = "")
|
param([string]$TargetIP = "", [int]$TargetPort = 0, [string]$Message = "")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($TargetIP -eq "" ) { $TargetIP = read-host "Enter target IP address" }
|
if ($TargetIP -eq "" ) { $TargetIP = read-host "Enter target IP address" }
|
||||||
|
@ -22,7 +22,7 @@ param([string]$File = "", [string]$SourceLang = "", [string]$TargetLang = "")
|
|||||||
function UseLibreTranslate { param([string]$Text, [string]$SourceLang, [string]$TargetLang)
|
function UseLibreTranslate { param([string]$Text, [string]$SourceLang, [string]$TargetLang)
|
||||||
$Parameters = @{"q"="$Text"; "source"="$SourceLang"; "target"="$TargetLang"; }
|
$Parameters = @{"q"="$Text"; "source"="$SourceLang"; "target"="$TargetLang"; }
|
||||||
$Result = (Invoke-WebRequest -Uri https://libretranslate.com/translate -Method POST -Body ($Parameters|ConvertTo-Json) -ContentType "application/json").content | ConvertFrom-Json
|
$Result = (Invoke-WebRequest -Uri https://libretranslate.com/translate -Method POST -Body ($Parameters|ConvertTo-Json) -ContentType "application/json").content | ConvertFrom-Json
|
||||||
start-sleep -milliseconds 3000 # 20 requests per minute maximum
|
Start-Sleep -milliseconds 3000 # 20 requests per minute maximum
|
||||||
return $Result.translatedText
|
return $Result.translatedText
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ function DetectSourceLang { param([string]$Filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function TranslateFilename { param([string]$Filename, [string]$SourceLang, [string]$TargetLang)
|
function TranslateFilename { param([string]$Filename, [string]$SourceLang, [string]$TargetLang)
|
||||||
|
[string]$SourceLanguage = ""
|
||||||
if ($SourceLang -eq "de") { $SourceLanguage = "Deutsch" }
|
if ($SourceLang -eq "de") { $SourceLanguage = "Deutsch" }
|
||||||
if ($SourceLang -eq "en") { $SourceLanguage = "English" }
|
if ($SourceLang -eq "en") { $SourceLanguage = "English" }
|
||||||
if ($SourceLang -eq "fr") { $SourceLanguage = "Français" }
|
if ($SourceLang -eq "fr") { $SourceLanguage = "Français" }
|
||||||
|
Loading…
Reference in New Issue
Block a user