Skip to content

Instantly share code, notes, and snippets.

View valadas's full-sized avatar

Daniel Valadas valadas

View GitHub Profile
@valadas
valadas / random-file-generator.ps1
Created February 23, 2024 19:14
Create random folder/files structure
View random-file-generator.ps1
param (
[string]$rootPath = (Get-Location).Path,
[int]$maxDepth = 3,
[int]$maxFoldersPerLevel = 4,
[int]$maxFilesPerFolder = 5
)
function New-RandomDirectoryStructure {
param (
[string]$rootPath,
@valadas
valadas / readme.md
Created March 27, 2023 20:45
Force IIS redirection to https for all urls
View readme.md

Forces all urls to use HTTPS in IIS

web.config

<configuration>
  ...
  ...
  <system.webServer>
 ...
@valadas
valadas / map-users-to-portal.sql
Created January 5, 2023 18:51
Maps all DNN Users to a portal
View map-users-to-portal.sql
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
DECLARE MY_CURSOR CURSOR
LOCAL STATIC READ_ONLY FORWARD_ONLY
FOR
SELECT DISTINCT UserID
@valadas
valadas / backup-databases.md
Last active April 28, 2023 22:47
Backup all databases from the CLI (or windows scheduler, with cleanup)
View backup-databases.md

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
valadas / dotnet-ubuntu-runner.md
Last active March 12, 2022 21:39
Setup Ubuntu github runner for .Net
View dotnet-ubuntu-runner.md

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
valadas / README.md
Last active April 28, 2023 16:13
DDR Menu to export pages
View README.md

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.