Skip to content

Instantly share code, notes, and snippets.

@itsho
itsho / StopWindowsTimeService.ps1
Created March 13, 2018 10:23
Stop windows time service - request Admin from end-user
# A self elevating PowerShell script
# https://blogs.msdn.microsoft.com/virtual_pc_guy/2010/09/23/a-self-elevating-powershell-script/
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
@itsho
itsho / MontyHallProblemSimulation.cs
Created March 19, 2017 12:22
Simulating Monty Hall problem - running X times to get estimation by using Random
using System;
namespace MontyHallProblemSimulation
{
public class Program
{
private static Random _rnd = null;
private static char[] _arrDoors;
private const char DOOR_WITH_CAR = '*';