Skip to content

Instantly share code, notes, and snippets.

View daemondevin's full-sized avatar

daemon.devin daemondevin

View GitHub Profile
@daemondevin
daemondevin / ModernWinVer.nsh
Created November 3, 2025 08:11
Modern Windows Version Detection Optimized for Windows 10, 11, and current Server versions
; ModernWinVer.nsh - Modern Windows Version Detection
; Optimized for Windows 10, 11, and current Server versions
; Extends and modernizes the standard WinVer.nsh
!ifndef MODERN_WINVER_NSH
!define MODERN_WINVER_NSH
!include LogicLib.nsh
; Windows Version Constants (Major.Minor.Build)
@daemondevin
daemondevin / WindowsFeature.nsh
Last active November 2, 2025 02:33
NSIS macros for checking and enabling Windows Features
; Check if Windows Feature needs to be enabled (e.g., .NET 3.5 on Windows 10+)
!define CheckWindowsFeature `!insertmacro _CheckWindowsFeature`
!macro _CheckWindowsFeature _FEATURE _RESULT
Push $0
Push $1
Push $R8
StrCpy ${_RESULT} "unknown"
; Use DISM to check Windows feature status
@daemondevin
daemondevin / codesign.rs
Last active October 18, 2025 09:18
Code signing utility written in Rust. This utility has support for generating a new RSA key pair, generating a self-signed certificate for code signing, signing a file with a certificate, and verifying a file signature.
// Code Signing Utility with Certificate Support
// Signs programs and verifies signatures using RSA cryptography with X.509 certificates
//
use base64::{engine::general_purpose, Engine as _};
use chrono::{Duration, Utc};
use clap::{Parser, Subcommand};
use der::{Decode, Encode};
use rsa::{
pkcs8::{DecodePrivateKey, DecodePublicKey, EncodePrivateKey, EncodePublicKey, LineEnding},
@daemondevin
daemondevin / lnk.rs
Last active October 18, 2025 07:30
Windows link creation utility written in Rust.
use std::{
ffi::OsStr,
os::windows::ffi::OsStrExt,
path::PathBuf,
ptr,
};
use owo_colors::OwoColorize;
use structopt::StructOpt;
@daemondevin
daemondevin / CheckLink.nsh
Last active September 18, 2025 16:43
Determines if a path is a symbolic link, junction, hard link, or regular file/directory
@daemondevin
daemondevin / CreateSymlink.nsh
Created September 6, 2025 23:20
This function creates Windows symbolic links with flexible options for different link types and path configurations.
@daemondevin
daemondevin / CreateJunction.nsh
Last active September 6, 2025 23:08
This function creates Windows directory junctions (symlinks for directories) using low-level Windows API calls.
/**
* CreateJunction.nsh v1.0
*
* Creates Windows directory junctions (symlinks for directories)
* using low-level Windows API calls.
*
* Macro Usage:
* ${CreateJunction} "$JunctionPath" "$TargetPath" $0 $1
* $0 holds true/false
* $1 holds error message if failed, empty if success
@daemondevin
daemondevin / CreateHardLink.nsh
Created September 6, 2025 22:54
This function creates Windows hard links with proper validation and error handling.
@daemondevin
daemondevin / INIParser.js
Created September 5, 2025 05:44
An INI parser class that can handle the standard INI format with sections, key-value pairs, comments, and various edge cases.
/**
* INI File Parser Class
* Parses INI configuration files with support for sections, comments, and various data types
*/
class INIParser {
constructor(options = {}) {
this.options = {
// Comment characters
commentChars: options.commentChars || [';', '#'],
// Whether to convert values to appropriate types
@daemondevin
daemondevin / CompareVersions.nsh
Created August 22, 2025 22:05
Compares two version strings (dot separated, e.g. "1.2.3.4")
/**
* CompareVersions
* 2025 daemon.devin (daemon.devin@gmail.com)
*
* Compares two version strings (dot separated, e.g. "1.2.3.4")
*
* Example:
* ${CompareVersions} $0 "1.0.0.1" "1.0.2.0"
* $0 ; -1 (1.0.0.1 < 1.0.2.0)
*