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
@asheroto
asheroto / Disable-EdgeAnnoyances.reg
Last active April 20, 2024 10:08
Disable annoying Microsoft Edge first run experience, implicit sign-in, disable shopping, rewards, default browser campaign, auto import, forced sync, sidebar, restore browser reminder. Shows home button, enables SmartScreen.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge\Recommended]
"UserFeedbackAllowed"=dword:00000000
"AutoImportAtFirstRun"=dword:00000001
"SmartScreenEnabled"=dword:00000001
"PersonalizationReportingEnabled"=dword:00000000
"ShowRecommendationsEnabled"=dword:00000000
"ForceSync"=dword:00000000
"SyncDisabled"=dword:00000001
@asheroto
asheroto / Disable-WooCommerce-Payment-Method-Message.php
Last active April 18, 2024 06:26
Disable WooCommerce payment method using warning/alert message instead of removing. Show the payment method, just disable it with a warning/alert message.
/****************************************************************************************
* START - Disable a payment gateway and show a custom message in WooCommerce
****************************************************************************************/
/**
* Define constants at the top for easy configuration.
*/
define('DISABLE_GATEWAY_ID', 'plisio');
define('DISABLE_MESSAGE', '<div class="woocommerce-error">Cryptocurrency payments are temporarily unavailable while we improve the payment process.</div>');
@asheroto
asheroto / Optimize-TCPSettings.ps1
Last active April 10, 2024 19:27
Adjusts various TCP and network settings in Windows to enhance the speed of the Internet connection.
Write-Output "Setting congestion provider to CTCP for Internet."
netsh int tcp set supplemental Internet congestionprovider=ctcp | Out-Null
Write-Output "Enabling Direct Cache Access, and configuring RSS and RSC settings globally."
netsh int tcp set global dca=enabled rss=enabled rsc=disabled | Out-Null
Write-Output "Disabling TCP timestamps globally."
netsh int tcp set global timestamps=disabled | Out-Null
Write-Output "Setting initial Retransmission Timeout (RTO) to 2000 milliseconds globally."
@asheroto
asheroto / 1-Windows-Setup-TPM-Bypass-Internet-Bypass.md
Last active April 4, 2024 20:44
Windows setup answer file working on Windows 11. Skips OOBE (EULA, networking) and pretty much everything else during normal setup.

Windows 10/11 Setup Answer File + TPM Bypass + CPU requirement + storage requirement + Internet requirement bypass

This is a Windows setup answer file working on Windows 10 and 11.

What it does:

  • Skips OOBE (EULA, networking) and pretty much everything else during normal setup
  • Sets Keyboard + Language to English (US)
  • Set timezone to Central Standard Time
  • Creates user "User" with password of "password"
@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 / Public-Key-Authentication-Troubleshooting.md
Last active March 29, 2024 17:00
OpenSSH on Windows - working sshd_config for public key authentication

Public key authentication troubleshooting

Make sure you don't have ANY instances of sshd or ssh-agent running (important):

  • Run PowerShell as Administrator:
Stop-Service sshd
Stop-Service ssh-agent
taskkill /f /im sshd.exe
taskkill /f /im ssh-agent.exe
@asheroto
asheroto / README.md
Last active March 23, 2024 08:31
Strip PowerShell output that contains spinner, progress bar, or more than one empty line.

Strip-Progress

Strip PowerShell output that contains spinner, progress bar, or more than one empty line. Fixes download progress formatting by effectively removing extra space after the slash, often seen in winget (example 269 MB / 305 MB).

When to use

This function can be beneficial when you're capturing the output stream of a command, but don't want the extra characters in the text. See examples. Works great with winget.

Usage

@asheroto
asheroto / Extract-IP-Addresses-and-Count.ps1
Last active February 29, 2024 10:04
PowerShell script to extract IP addressees from a file and count the number of occurrences of each IP address.
function ExtractIPaddressesAndCount {
[CmdletBinding()]
param(
[Parameter(Position = 0, mandatory = $true)]
[string] $InputFile,
[Parameter(Position = 1, mandatory = $true)]
[string] $OutputFile
)
If (-Not(Test-Path -Path $InputFile -PathType Leaf)) {
@asheroto
asheroto / README.md
Last active February 4, 2024 04:28
Example of daemonized teler

Example of daemonized teler

This example turns teler into a service, then implements inotifywatch to monitor the configuration file for changes. This way teler will automatically load on start on boot, and when config.yaml changes the teler service will restart and load the changes.

Steps

  1. Install inotify-tools
apt-get -y install inotify-tools
@asheroto
asheroto / README.md
Last active February 3, 2024 00:16
Easily install and configure GeoIP for use with iptables which enables you to block/allow entire countries.

Configure GeoIP for iptables

This script configures GeoIP for use with iptables. Installs Linux headers, uses xtables-addons, uses latest db-ip.com database, fixes dependencies, loads xt_geoip module.

Supports colored message using ANSI escape codes. 😎

Script Functionality