Skip to content

Instantly share code, notes, and snippets.

View asheroto's full-sized avatar
:electron:
Calculating Universe

asheroto

:electron:
Calculating Universe
View GitHub Profile
_CommonRedist
game
qt5_plugins
steamapps
subtools
amd_ags_x64.dll
animationsystem.dll
assetpreview.dll
ati_compress_wrapper.dll
bugreporter_filequeue.dll
@asheroto
asheroto / ImportPFX.ps1
Created October 11, 2023 05:47
Import PFX files with PowerShell using the .NET class.
# Load the PFX file into an X509Certificate2 object
$pfxPath = "path_to_your.pfx"
$password = "your_password" # Consider using SecureString for production use
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
# Import the PFX into the certificate object
$cert.Import($pfxPath, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet)
# Add the certificate to the desired store (in this case, the Personal store of the CurrentUser)
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store "My", "CurrentUser"
@asheroto
asheroto / README.md
Created October 7, 2023 05:48
Easily load and reset Cloudflare Turnstile when an element (div) appears. For example, when success element is shown, reset Turnstile.

Easily load and reset Cloudflare Turnstile when an element (div/span) appears. For example, when success element is shown, reset Cloudflare Turnstile.

The purpose of this script is to handle the situation where you want to reset Cloudflare Turnstile after a contact form was submitted, so that someone could submit the form again without having to reload the page.

Script Functionality

  1. Loads Cloudflare Turnstile dynamically (only import this turnstile.js script in your main HTML) without the need to import it on a separate line
  2. Waits until the triggerWhenVisibleSelector becomes visible
  3. Resets Cloudflare Turnstile so it can be used again

How to use

@asheroto
asheroto / PS-Write-Section.ps1
Last active September 29, 2023 11:08
PowerShell function named Write-Section that prints/writes/outputs messages to the console surrounded by a decorative hash border ( # character). It improves console readability and supports multiple message types such as warnings, debug, verbose, and information. The function also features graceful word wrapping to fit within the console width.
function Write-Section {
<#
.SYNOPSIS
Prints a text block surrounded by a section divider for enhanced output readability.
.DESCRIPTION
This function takes a message input and prints it to the console, surrounded by a section divider made of hash characters.
It enhances the readability of console output by categorizing messages based on the Type parameter.
.PARAMETER Message
@asheroto
asheroto / Monitor-EXE-File-Version-Updates.js
Last active October 14, 2023 04:59
Automatically monitor EXE file version updates at a static URL. This is a JavaScript tool that uses Puppeteer/Apify tool to monitor changes, compare versions, and makes GET request to send notifications for updated executable files (but you can change it to anything you'd like of course). Uses anti-bot detection measures such as with Cloudflare.
/*
This script checks a URL for a new version of an EXE and sends an alert if a new version is available (via GET request). It is intended to run on a schedule,
whether cron, Task Scheduler, or a service like Apify. It uses the puppeteer-extra-plugin-stealth package to avoid issues with Cloudflare and other anti-bot measures.
How to use:
- Set the CURRENT_VERSION environment variable to the current version number you want to compare against
- Set the FILE_URL environment variable to the URL of the file you want to check
- Set the SECRET_URL environment variable to the URL of the secret page you want to send an alert to
- Adjust the full SECRET_URL as needed, the one provided is just an example method of sending an alert, you can of course use any method you want

Get-IntelProcessorGeneration

Retrieves the Intel process generation. CPU generation as described here.

image

@asheroto
asheroto / Floating-Google-Translate-Website-Plugin.md
Created September 6, 2023 06:21
Floating Google Translate plugin for webpage in HTML, CSS, JS.

Floating Google Translate Website Plugin

Uses HTML, CSS, and JS to create a Google Translate combobox/dropdown at the bottom-right side of any webpage.

Example:

image

@asheroto
asheroto / Set-EnvironmentVariable.ps1
Last active August 30, 2023 07:06
Functions to instantly get, set, or delete an environment variable. Bypasses the typical delay experienced with Environment.SetEnvironmentVariable, which can be slow due to its broadcasting a message to all top-level windows. These functions offer a more efficient alternative for getting, setting, or deleting environment variables.
# See this for more info:
# https://stackoverflow.com/questions/4825967/environment-setenvironmentvariable-takes-a-long-time-to-set-a-variable-at-user-o
function Set-EnvironmentVariable {
<#
.SYNOPSIS
Instantly sets an environment variable in the machine or user environment by updating the registry.
.DESCRIPTION
Instantly sets an environment variable in the machine or user environment by updating the registry.
@asheroto
asheroto / Get-OSInfo.ps1
Last active November 24, 2023 03:10
Get-OSInfo is a PowerShell function that retrieves key details about the Windows OS, including Release ID, Display Version, Name, Type (Workstation/Server), Numeric Version, Edition ID, Version (an object that includes major, minor, and build numbers), and Architecture (OS architecture, not processor architecture).
function Get-OSInfo {
<#
.SYNOPSIS
Retrieves detailed information about the operating system version and architecture.
.DESCRIPTION
This function queries both the Windows registry and the Win32_OperatingSystem class to gather comprehensive information about the operating system. It returns details such as the release ID, display version, name, type (Workstation/Server), numeric version, edition ID, version (object that includes major, minor, and build numbers), and architecture (OS architecture, not processor architecture).
.EXAMPLE
Get-OSInfo
@asheroto
asheroto / Webroot-Poll.cmd
Created June 26, 2023 23:23
Trigger Webroot (WRSA.exe) to poll the server for updates or policy changes.
@echo off
:: Relaunch script as admin if needed
NET FILE > NUL 2>&1 || POWERSHELL -ex Unrestricted -Command "Start-Process -Verb RunAs -FilePath '%ComSpec%' -ArgumentList '/c \"%~fnx0\" %*'" && EXIT /b
:: Code
echo.
if exist "C:\Program Files (x86)\Webroot\WRSA.exe" "C:\Program Files (x86)\Webroot\WRSA.exe" -poll & echo POLLED: "C:\Program Files (x86)\Webroot\WRSA.exe"
if exist "C:\Program Files\Webroot\WRSA.exe" "C:\Program Files\Webroot\WRSA.exe" -poll & echo POLLED: "C:\Program Files\Webroot\WRSA.exe"
echo.