Skip to content

Instantly share code, notes, and snippets.

@maaduukaar
maaduukaar / disable-windows11-bloat.ps1
Last active November 7, 2025 12:56
Скрипт отключающий лишнюю нагрузку системных процессов на Windows 11
<#
PowerShell script: disable-windows11-bloat.ps1
Purpose: to disable background services, updates, telemetry, and other non-essential Windows 11 components to reduce resource usage.
WARNING: This makes the system vulnerable (no antivirus, no updates). Use only on controlled or offline servers.
Creates registry backups and a log of actions in C:\Temp\win11_cleanup_backup_YYYYMMDD_HHMMSS
#>
# --- Language selection ---
Write-Host "Select language / Выберите язык:" -ForegroundColor Cyan
Write-Host "1 - English" -ForegroundColor Yellow
# 1. Включить удалённые подключения
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name 'fDenyTSConnections' -Value 0
# 2. Разрешить RDP через брандмауэр
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
# 3. (опционально) Включить службу RDP, если она выключена
Set-Service -Name TermService -StartupType Automatic
Start-Service -Name TermService
@maaduukaar
maaduukaar / keyword-checker.py
Last active August 25, 2025 15:33
Script to check HTML pages for specific keywords and export results to Excel.
import requests
from bs4 import BeautifulSoup
import pandas as pd
import os
import argparse
import re
# CLI arguments
parser = argparse.ArgumentParser(description="Check WordPress posts for keywords.")
parser.add_argument("-w", "--whole", action="store_true", help="Match whole words only")
@maaduukaar
maaduukaar / create_backup.php
Created August 12, 2025 14:54
PHP script to create a ZIP archive of the entire website, excluding the script itself and the backup folder. ⚠️ Delete after use!
<?php
/**
* ⚠️ IMPORTANT! SECURITY WARNING! ⚠️
* DELETE THIS FILE FROM THE SERVER AFTER USE!
* Leaving this script on the server poses a security risk,
* as attackers can use it to create archives
* containing sensitive data from your website.
*/
// Check if ZipArchive class is available
@maaduukaar
maaduukaar / combine_images.py
Created August 1, 2025 14:49
A Python script to combine multiple images onto a single A4 page, useful for printing. Supports various layouts: 2 or 4 images per page, in both horizontal and vertical orientations. Features natural sorting for filenames and an interactive confirmation prompt.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
from PIL import Image
import argparse
from pathlib import Path
import re
@maaduukaar
maaduukaar / wp-category-articles-to-excel.py
Last active July 28, 2025 10:54
Python script to fetch articles from a WordPress parent category and all its subcategories via REST API, then export to Excel with clickable titles and modification dates. Supports recursion for nested categories. Example usage: Enter a category URL, and it generates an XLSX file.
import requests
from urllib.parse import urlparse
from datetime import datetime
from openpyxl import Workbook
from openpyxl.styles import Font
# — Function: date formatting
def format_date(date_str):
dt = datetime.fromisoformat(date_str.replace('Z', '+00:00'))
return dt.strftime('%d.%m.%Y')
@maaduukaar
maaduukaar / get_rate.txt
Last active July 10, 2025 08:23
Get Toncoin rate to Google Spreadsheets
EN:
=VALUE(SUBSTITUTE(IMPORTXML("https://coinmarketcap.com/currencies/toncoin/"; "//span[@data-test='text-cdp-price-display']"); "$"; ""))
RU:
=ЗНАЧЕН(ПОДСТАВИТЬ(ПОДСТАВИТЬ(IMPORTXML("https://coinmarketcap.com/currencies/toncoin/"; "//span[@data-test='text-cdp-price-display']"); "$"; ""); "."; ","))
@maaduukaar
maaduukaar / window_info.py
Last active July 1, 2025 09:47
Get window titles, positions, and sizes on Windows using Python.
import pygetwindow as gw
# Get a list of all windows with non-empty titles
windows = [w for w in gw.getAllWindows() if w.title.strip() != '']
# Check if there are any available windows
if not windows:
print("No windows with non-empty titles were found.")
exit()
import os
import re
def replace_in_html_files(pattern, replacement, folder_path):
# Компилируем регулярное выражение
regex = re.compile(pattern, re.DOTALL | re.IGNORECASE)
# Счетчики для статистики
total_files = 0
processed_files = 0
import os
def replace_in_html_files(pattern, replacement, folder_path):
# Счетчики для статистики
total_files = 0
processed_files = 0
files_with_matches = 0
files_without_matches = 0
total_matches = 0