Skip to content

Instantly share code, notes, and snippets.

View valadas's full-sized avatar

Daniel Valadas valadas

View GitHub Profile
valadas / BackupFilesExcludingGlob.ps1
Created July 2, 2024 03:29
Does a file backup of a specific subfolder, excluding some glob patterns.
# Set the path to the 7-Zip executable
$zipExePath = "C:\Program Files\7-Zip\7z.exe"
# Define the parent directory from which child folders will be listed
$parentDirectory = "C:\wwwroot"
# List all child directories
$directories = Get-ChildItem -Path $parentDirectory -Directory
# Check if there are any directories found
valadas / random-file-generator.ps1
Created February 23, 2024 19:14
Create random folder/files structure
param (
[string]$rootPath = (Get-Location).Path,
[int]$maxDepth = 3,
[int]$maxFoldersPerLevel = 4,
[int]$maxFilesPerFolder = 5
function New-RandomDirectoryStructure {
param (
valadas /
Created March 27, 2023 20:45
Force IIS redirection to https for all urls

Forces all urls to use HTTPS in IIS


valadas / map-users-to-portal.sql
Created January 5, 2023 18:51
Maps all DNN Users to a portal
DECLARE @UserId int
DECLARE @PortalId int
SET @PortalId = 6 -- <<<< Adjust to your portal ID
DECLARE @Authorized bit
SET @Authorized = 0 -- <<<< Adjust if you want the users to be authorized or not
valadas /
Last active April 28, 2023 22:47
Backup all databases from the CLI (or windows scheduler, with cleanup)

The first line of this script will connect to sql server and backup all databases with the Full option. The first line will delete any existing backup in the folder that is more than 5 days old (you can change the value 5 to whatever suites your needs).

valadas /
Last active March 12, 2022 21:39
Setup Ubuntu github runner for .Net

Install Ubuntu

  • Install Ubuntu 18.04 server

Setup runner

  • Follow github instructions to add a runner by going to a repository settings and creating a new self-hosted runner

Make it run on the runner

  • Edit the yml file to start a first run on it (which will probably fail due to lacking build tools)

Install .Net

valadas /
Last active April 28, 2023 16:13
DDR Menu to export pages

This is a DDR Menu template to export a text format of a DNN site pages to reuse in the "Create Multiple Pages" feature on another site.