Skip to content

Instantly share code, notes, and snippets.

itsho / AddCertificateToCaBundle.ps1
Last active Jul 12, 2021
Add given certificate to ca-bundle.crt
View AddCertificateToCaBundle.ps1
# self elevate this script to run as admin
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit
$newCertContent = "# Certificate name for easy search
itsho / CreateMissingHashFile.ps1
Created Mar 4, 2020
Create missing SHA256-hash-file for NuGet
View CreateMissingHashFile.ps1
#requires -version 4.0
[string]$Path )
Process {
Write-verbose "Creating hash for input file..."
$hash = (Get-FileHash -Path $Path -Algorithm "SHA256").Hash
itsho / RunThemidaMultiProcess.ps1
Created Jun 13, 2019
Run Themida on multiple files with multiple instances of Themida.exe
View RunThemidaMultiProcess.ps1
# Enable -Verbose option
[string]$dllsFolder = "$PSScriptRoot",
[string]$txtWithFileList = "$PSScriptRoot\ListOfFilesToUseInThemida.txt",
[string]$themida32Path = "C:\Program Files\Themida\Themida.exe",
[string]$themidaProject = "D:\ThemidaProject.tmd",
[int]$totalProcesses = 8
itsho / HwndHostEx.cs
Last active May 7, 2019
Hosting an app inside a WPF app (System.Windows.Interop)
View HwndHostEx.cs
using System;
using System.Runtime.InteropServices;
using System.Windows.Interop;
namespace HostingAppTest
// based on
public class HwndHostEx : HwndHost
private readonly IntPtr _childHandle;
itsho / TabletKeyboardAutoOpen.xaml
Last active Jan 2, 2019
Compile this WPF project with 4.6.2+ and run on Windows 10 1607+ (Anniversary Update)
View TabletKeyboardAutoOpen.xaml
<Window x:Class="TabletKeyboardAutoOpen.MainWindow"
itsho / RSA_SignAndVerify.cs
Last active Jul 8, 2019
RSA - create signature and verify
View RSA_SignAndVerify.cs
// ----------------------------------------------------
// Notice, this code is using BouncyCastle NuGet:
// Created by: Itsho
// Creation Date: 20 December 2018
// ----------------------------------------------------
using Org.BouncyCastle.Asn1.Pkcs;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Generators;
itsho / Force 100 DPI Scale.ps1
Created Dec 20, 2018
Force 100% DPI Scaling for all screens even if the default value is different
View Force 100 DPI Scale.ps1
# =========================================================================================================
# if you like to reset your DPI Scaling to the DEFAULT, you can use the registry (Option five) from here:
# But, since the default value is different on various monitors, if you like to force 100%,
# you need the following trick:
# for each monitor - set DPIValue to 0xFFFFFFFF (which is -1 in DWord)
# Last update: 18 December 2018
# Created by: Itsho
itsho / InnoScript_CompareVersionStrings.iss
Created May 22, 2018
Compare Versions as strings in InnoScript. fixed html tags from source article
View InnoScript_CompareVersionStrings.iss
// ----------------Compare versions - start ------------------
// source:
// Procedure to split a string into an array of integers
procedure Explode(var Dest: TArrayOfInteger; Text: String; Separator: String);
i, p: Integer;
i := 0;
SetArrayLength(Dest, i+1);
itsho / StopWindowsTimeService.ps1
Created Mar 13, 2018
Stop windows time service - request Admin from end-user
View StopWindowsTimeService.ps1
# A self elevating PowerShell script
# Get the ID and security principal of the current user account
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the Administrator role
itsho / MontyHallProblemSimulation.cs
Created Mar 19, 2017
Simulating Monty Hall problem - running X times to get estimation by using Random
View MontyHallProblemSimulation.cs
using System;
namespace MontyHallProblemSimulation
public class Program
private static Random _rnd = null;
private static char[] _arrDoors;
private const char DOOR_WITH_CAR = '*';