Skip to content

Instantly share code, notes, and snippets.

alias getsecret="_getsecret"
# ~/.secrets/secrets.json !!! chmod 400
# {
# "group1": {
# "secret1":"value",
# "secret2":"value"
# },
#Save this file to C:\Scripts\clean-iislogs.ps1
#Run this command to create the schedule task:
# schtasks /create /sc DAILY /tn "Clean IIS Logs" /tr "powershell.exe -ExecutionPolicy Bypass C:\Scripts\clean-iislogs.ps1" /rl highest /ru system /st "03:00"
$FilePath = "C:\inetpub\logs"
$FileExt = "*.log"
$maxDaystoKeep = 90
$DeleteDateTime = ((get-date).AddDays(-$maxDaystoKeep))
#Get a list of files to be deleted
#Download a Dictionary as a CSV file, then pick 5 random words to return
$DictionaryURL="https://www.kaggle.com/datasets/dfydata/the-online-plain-text-english-dictionary-opted?resource=download"
$DictionaryZIP="dictionary.zip"
Invoke-WebRequest -Uri $DictionaryURL -OutFile $DictionaryZIP#
Expand-Archive $DictionaryZIP -DestinationPath .
$EnglishDictionary = import-csv -path .\OPTED-Dictionary.csv
1..5 | % { $EnglishDictionary[$(Get-Random $EnglishDictionary.Count)] | Select Word, Definition }