Skip to content

Instantly share code, notes, and snippets.

View rasmuseeg's full-sized avatar
💭
Coding ofc.

Rasmus Eeg Møller rasmuseeg

💭
Coding ofc.
View GitHub Profile
$AutoUpdateNotificationLevels = @{0 = "Not configured"; 1 = "Disabled" ; 2 = "Notify before download";
3 = "Notify before installation"; 4 = "Scheduled installation"
}
$AutoUpdateDays = @{0 = "Every Day"; 1 = "Every Sunday"; 2 = "Every Monday"; 3 = "Every Tuesday"; 4 = "Every Wednesday";
5 = "Every Thursday"; 6 = "Every Friday"; 7 = "EverySaturday"
}
Function Set-WindowsUpdateConfig {
@rasmuseeg
rasmuseeg / Rte.cshtml
Created August 25, 2015 12:43
Parsing Macro's inside GridEditors
@using Umbraco.Web.Templates;
@using System.Text.RegularExpressions;
@using HtmlAgilityPack;
@model dynamic
<div class="cmscontent">
@Html.Raw(TemplateUtilities.ParseInternalLinks(ParseMacros(Model.value.ToString())))
</div>
@functions{
@rasmuseeg
rasmuseeg / versioning.yml
Created February 10, 2022 20:03
Azure variable template for verisoning
variables:
version.counter: $[counter(format('{0}_{1}', variables['Build.DefinitionName'], variables['Build.SourceBranchName']), 1)]
version.suffix: $[format('alpha-{0}{1}', variables['Build.SourceBranchName'], variables['version.counter'])] # Unknown branches are WIP
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/release/') }}:
version.suffix: $[format('rc-{0}{1}', variables['Build.SourceBranchName'], variables['version.counter'])] # Ready for release
${{ if eq(variables['Build.SourceBranchName'], 'main') }}:
version.suffix: '' # No suffix for releases
using System;
using System.Linq;
using System.Web;
using System.Web.Mvc;
public static class UrlHelperExtensions
{
/// <summary>
/// Modified QueryString with key to value
/// </summary>
@rasmuseeg
rasmuseeg / SMTP.aspx
Last active January 20, 2022 00:47
Simple SMTP test aspx page for sending and testing smtp configuration and server response.
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Net.Mail" %>
<%@ Import Namespace="System.Net.Sockets" %>
<%@ Import Namespace="System.Net.Security" %>
<%@ Import Namespace="System.Net.Configuration" %>
<%@ Import Namespace="Umbraco.Core.Configuration" %>
<%@ Page Language="C#" %>
@rasmuseeg
rasmuseeg / ConvertFrom-UnixTime
Created October 8, 2021 13:12
Converts unix or epoch times to DateTime object.
function ConvertFrom-UnixTime {
[CmdletBinding(DefaultParameterSetName = "Seconds")]
param (
[Parameter(Position = 0,
ValueFromPipeline = $true,
Mandatory = $true,
ParameterSetName = "Seconds")]
[int]
$Seconds,
@rasmuseeg
rasmuseeg / VBScript class for json encode decode
Last active September 28, 2021 12:08 — forked from douglascrp/VBScript class for json encode decode
JSON encode decode with VBScript
Reference: http://demon.tw/my-work/vbs-json.html
VbsJson class for parsing JSON format data with VBS
Tags: JavaScript , JSON , VB , VBS , VBScript
Title: The VBS resolve VbsJson class of JSON data format of: Demon
Link: http://demon.tw/my-work/vbs-json.html
Copyright: All articles in this blog are subject to the terms of " Signature - Non-Commercial Use - Share 2.5 China in the Same Way ".
@rasmuseeg
rasmuseeg / Dockerfile
Last active August 19, 2021 07:20
The following example allows .NET 4.7.2 console applications to listen for SIGINT, SIGTERM inside windows containers.
# This causes Windows to wait the specified number of seconds before sending CTRL_SHUTDOWN_EVENT to the process.
# #RUN reg add hklm\system\currentcontrolset\services\cexecsvc /v ProcessShutdownTimeoutSeconds /t REG_DWORD /d 7200
# This causes Windows to wait the specified number of milliseconds before killing a process after issuing a CTRL_SHUTDOWN_EVENT - essentially the rough equivalent of docker stop -t.
RUN reg add hklm\system\currentcontrolset\control /v WaitToKillServiceTimeout /t REG_SZ /d 7200000 /f
@rasmuseeg
rasmuseeg / ConvertFrom-Ini.ps1
Last active August 9, 2021 12:46
Read ini file contents using powershell
function ConvertFrom-Ini ($filePath)
{
$ini = @{}
$section = $ini
switch -regex -file $FilePath
{
“^\[(.+)\]” # Section
{
$section = $matches[1]
$ini.Add($section,@{})
@rasmuseeg
rasmuseeg / XmlConvert.cs
Last active May 11, 2021 13:58
My version of XmlConvert like the JsonConvert on Newtonsoft.Json
public static class XmlConvert
{
public static string SerializeObject<T>(T dataObject, Formatting formatting = Formatting.None)
{
if (dataObject == null)
{
return string.Empty;
}
try
{