Navigation Menu

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-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 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 / 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

@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 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 / 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 January 25, 2024 21:52
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 January 11, 2024 07:35
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 December 15, 2023 10:44
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 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."