Powershell Resume Script

Scripts to generate company email specific CV/Resume PDF(s). This is useful for job application email filtering. work.email@my_domain.com will be work.company_name@my_domain.com. The mailto link for the email will also be updated accordingly. CreatePDF.ps1 Creates a PDF by prompted input text in user Desktop. $TextFile = Read-Host -Prompt 'File name' $TextFile = $TextFile.ToLower().Replace(' ', '') $Word = New-Object -ComObject Word.Application $Word.Visible = $false $word.DisplayAlerts = "wdAlertsNone" $Filename = "\path\to\folder\my_resume.docx" $NewFileName = $Filename.Replace(".docx","") $Document = $Word.Documents.open($Filename) $objSelection = $Document.Selection "Processing file: {0}" -f $Document.FullName $DesktopPath = [Environment]::GetFolderPath("Desktop") $FindText = "email@" $MatchCase = $false $MatchWholeWorld = $true $MatchWildcards = $false $MatchSoundsLike = $false $MatchAllWordForms = $false $Forward = $false $Wrap = 1 $Format = $false $Replace = 1 # Replace email with company name $ReplaceText = $FindText -Replace "email",$TextFile $Document.Content.Find.Execute($FindText, $MatchCase, $MatchWholeWorld, $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap, $Format, $ReplaceText, $Replace) # Replace mailto hyperlink $Document.Hyperlinks | ForEach-Object { if ($_.Address -like "*email@*") { $NewAddress = $_.Address -Replace "email",$TextFile $_.Address = $NewAddress # Copies new email to clipboard $NewAddress = $NewAddress -Replace "mailto:", "" | Set-Clipboard } } # Export as pdf $Pdf = $DesktopPath + "`\" + $Document.Name.Replace(".docx", "") + "`-$TextFile.pdf" $Document.ExportAsFixedFormat($Pdf,17) "Exported document as {0} `r`n" -f $Pdf # Quit Word without saving $Document.Close($false) $Word.Quit() CreatePDFs.ps1 Create multiple PDFs based on text file in .docx file directory. ...

February 14, 2023 · 2 min · 353 words · Wei Wang

Duplicati Nextcloud Backup Script

When Duplicati backups and restores Nextcloud files, we want to enable maintenance mode. However by default, Duplicati runs scripts on every operation including when it lists the restore folders, which we don’t want. The following scripts prevents Duplicati from running the script when it’s only listing the restore folders. NextcloudOn.sh Script to turn on Nextcloud Maintenance mode #!/bin/bash if [ "%DUPLICATI__OPERATIONNAME%" != "List" ] then nextcloud.occ maintenance:mode --on fi exit 0 NextcloudOff.sh Script to turn off Nextcloud Maintenance mode ...

February 13, 2023 · 1 min · 130 words · Wei Wang

Duplicati Setup on Ubuntu

Package Repository Setup Adding Mono Repository Add the Mono repository to your system as Duplicati requires mono in order to work. sudo apt install gnupg ca-certificates sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list sudo apt update sudo apt install mono-devel gtk-sharp2 Downloading Duplicati Get the url of the latest version of Duplicat from this link. Run wget to download the file. Replace the link below with the link you got from above. ...

February 13, 2023 · 3 min · 481 words · Wei Wang