Skip to content

Instantly share code, notes, and snippets.

View asheroto's full-sized avatar
😎

asheroto

😎
View GitHub Profile
@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 / README.md
Last active October 14, 2025 06:38
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 / README.md
Last active October 8, 2025 01:08
Easily install and configure GeoIP for use with iptables which enables you to block/allow entire countries.

Configure GeoIP for iptables

Important

This setup forces iptables-legacy (not nftables) and installs a custom-built xt_geoip_query tool written in C to properly read modern GeoIP databases (xtables-addons ≥ 3.20). The script does not modify firewall rules automatically; it only echoes recommended examples.

Caution

If you use Docker or containerized services, switching to iptables-legacy can temporarily break container networking. This happens because Docker manages its own NAT and MASQUERADE rules, which can be lost when iptables backends change or modules are reloaded. SEE NOTES BELOW.

@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 / Disable-EdgeAnnoyances.reg
Last active October 30, 2025 00:17
Disables Edge’s first run, sign-in, Copilot, shopping, rewards, sync, sidebar, new tab clutter, and more; keeps SmartScreen, downloads, and home button enabled.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge]
"ShowDownloadsToolbarButton"=dword:00000001
"ShowRecommendationsEnabled"=dword:00000000
"CopilotPageContext"=dword:00000000
"ShowAcrobatSubscriptionButton"=dword:00000000
"PersonalizeTopSitesInCustomizeSidebarEnabled"=dword:00000000
"Microsoft365CopilotChatIconEnabled"=dword:00000000
"NewTabPageContentEnabled"=dword:00000000
@asheroto
asheroto / Install-Font.ps1
Last active January 29, 2024 19:21
PowerShell function to install fonts on Windows. Supports both individual and bulk file installations. Offers wildcard and recursive directory searching. TTF and OTF fonts supported by default.
Function Install-Font {
<#
.SYNOPSIS
Installs fonts from a specified path on Windows systems.
.DESCRIPTION
The Install-Font function supports handling individual font files, directories containing multiple fonts, and wildcard paths. It also supports recursive search for font files in the specified path and all its subdirectories. The function is capable of installing both TTF and OTF font types.
.PARAMETER Path
Specifies the path to the font file(s). This can be a path to an individual font file, a directory containing font files, or a wildcard path. The function accepts both relative and absolute paths.
@asheroto
asheroto / Create-NewOutlookEmail.ps1
Last active October 30, 2025 00:45
Create e-mails in Outlook using PowerShell. Select account, keep default signature, keep original formatting, produce valid HTML.
function Create-NewOutlookEmail {
param (
[Parameter(Mandatory = $true)]
[string]$To,
[Parameter(Mandatory = $true)]
[string]$Subject,
[Parameter(Mandatory = $true)]
[string]$Body, # Expecting HTML formatted string
@asheroto
asheroto / Disable-PowerShellTelemetry.ps1
Last active May 30, 2024 05:27
Scripts to disable PowerShell Telemetry and Update Check. Scripts add the System environment variables.
# Disables PowerShell telemetry by setting the environment variable associated with it.
# More info: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_telemetry
#Requires -RunAsAdministrator
# See this for more info:
# https://gist.github.com/asheroto/5c1711fcbd888c5a621b1ff0b91dfc00
# 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.
function Set-EnvironmentVariable {
@asheroto
asheroto / README.md
Last active June 23, 2025 14:05
Nextcloud - Show gallery view by default with public / sharing / shared folders

Nextcloud - Show gallery view by default with public / sharing / shared folders

This will automatically switch a public or shared folder to gallery view when loading.

This only works on public or shared folders on Nextcloud and will not affect normal folders viewed under your user account.

Tested and working on Nextcloud 27+.

How to Configure

  1. Open core/js/public/publicpage.js.
@asheroto
asheroto / Optimize-TCPSettings.ps1
Last active October 30, 2025 00:47
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."