Skip to content

Instantly share code, notes, and snippets.

View jeroensmink98's full-sized avatar
💭
Remote working

Jeroen Smink jeroensmink98

💭
Remote working
View GitHub Profile
@jeroensmink98
jeroensmink98 / register_deployment_agent.ps1
Created January 19, 2022 15:35
Register Deployment agent
#Requires -Version 3
#Requires -RunAsAdministrator
<#
.SYNOPSIS
Downloads and installs an Azure Pipelines Agent on the current machine,
and registers it with the specified Azure Devops organization, project, and environment.
.DESCRIPTION
This cmdlet downloads an Azure Pipelines Agent on the current machine, installs it to C:\azagent,
and finally runs the .\config.cmd command, which registers the agent with the specified
@jeroensmink98
jeroensmink98 / angular_single_file.js
Created January 25, 2022 11:13
Compile a Angular Project to a single HTML file
// Create gulpfile.js
const gulp = require("gulp");
const inline = require("gulp-inline");
gulp.task("default", () => {
return gulp
.src("./dist/*/*.html")
.pipe(inline())
.pipe(gulp.dest("./single-dist"));
});
@jeroensmink98
jeroensmink98 / git.md
Last active April 13, 2022 07:47
Some simple Git commands

Basic Git Commands

Some simple Git commands

Checkout a new branch

  • git pull
  • git checkout -b [name_of_your_new_branch]
  • git push origin [name_of_your_new_branch]

Commiting

# Set the root folder path
$rootFolderPath = (Get-Location).Path
# Set the nugetType variable
$nugetType = "Framework"
# Create the .pipelines folder if it doesn't exist
$pipelinesFolderPath = Join-Path -Path $rootFolderPath -ChildPath ".pipelines"
if (-not (Test-Path -Path $pipelinesFolderPath)) {
New-Item -ItemType Directory -Path $pipelinesFolderPath | Out-Null
#############################################
# Variables #
#############################################
# Set the folder path where the YAML files are stored
$folderPath = "C:\tres-internet-nuget-umbraco8\.pipelines"
# Set the name of the Azure DevOps pipeline folder
$azureDevOpsPipelineFolder = "My Pipeline Folder"
@jeroensmink98
jeroensmink98 / export-wsl-distro.ps1
Created April 19, 2023 20:31
Create an export of your favorite WSL2 Distro
# Set the path to your desired output folder
$outputFolder = "C:\WSL_Backup"
# Create the output folder if it doesn't exist
if (!(Test-Path $outputFolder)) {
New-Item -ItemType Directory -Path $outputFolder | Out-Null
}
# Get the current date and time in a format suitable for filenames
$date = Get-Date -Format "yyyy-MM-dd_HHmmss"
var keyVaultName = builder.Configuration["KeyVaultName"];
var azureADDirectoryId = builder.Configuration["AzureADDirectoryId"];
var azureADApplicationId = builder.Configuration["AzureADApplicationId"];
var azureADCertThumbprint = builder.Configuration["AzureADCertThumbprint"];
builder.Host.ConfigureAppConfiguration((hostingContext, config) =>
{
using (var x509Store = new X509Store(StoreLocation.CurrentUser))
{
@jeroensmink98
jeroensmink98 / script.ps1
Created May 12, 2023 10:05
Fetch all Azure Repos and branches for a project
$project = "PROJECT_NAME"
try {
$repos = az repos list -p $project | ConvertFrom-Json
} catch {
Write-Host "Failed to fetch repositories for project $project"
exit
}
$results = @()
@jeroensmink98
jeroensmink98 / polarsteps.js
Created May 31, 2023 18:09
Parse data from a Polarsteps trip.json and create a new JSON out of it with parsed dates
const fs = require('fs');
const jsonString = fs.readFileSync('./assets/trip.json', 'utf8');
// Parse the JSON string into an object
const data = JSON.parse(jsonString);
const locations = [];
@jeroensmink98
jeroensmink98 / cleanup.ps1
Last active August 8, 2023 08:21
Clean remote environments using WinSCP
# Define input parameters for the script
# .\cleanup.ps1 -exclusionList "SOME_FILE_NOT_TO_REMOVE/FOLDER/FILE.js", "/www/app/Folder2/File9.txt" -rootFolder "/www" -username "FTP_USERNAME" -password "FTP_PASSWORD"
param (
[string[]]$exclusionList, # List of files or directories to exclude
[string]$rootFolder, # Starting folder from where files will be enumerated
[string]$ftpServer = "ftp.by-tres.nl", # FTP server address (default is set)
[Parameter(Mandatory=$true)] # Make the username parameter mandatory
[string]$username, # FTP server username
[Parameter(Mandatory=$true)] # Make the password parameter mandatory
[string]$password # FTP server password