Skip to content

Instantly share code, notes, and snippets.

@tomi500
tomi500 / recover-composer-json.sh
Last active August 30, 2025 14:12
Recover composer.json from composer.lock + vendor packages
#!/bin/bash
# recover-composer-json.sh
# Recover composer.json from composer.lock + vendor packages
# Automatically sets "name" from folder name in vendor/package format
# Supports exact versions or version ranges via one boolean argument
# Safely handles existing composer.json
# Adds mode info in description
# Skips vendor scan if folder missing
# Requirements: jq, GNU sed
<?php
/**
* Delete all transients from the database whose keys have a specific prefix.
*
* @param string $prefix The prefix. Example: 'my_cool_transient_'.
*/
function delete_transients_with_prefix( $prefix ) {
foreach ( get_transient_keys_with_prefix( $prefix ) as $key ) {
delete_transient( $key );
KFZUS-F3JGV-T95Y7-BXGAS-5NHHP
T3ZWQ-P2738-3FJWS-YE7HT-6NA3K
KFZUS-F3JGV-T95Y7-BXGAS-5NHHP
65Z2L-P36BY-YWJYC-TMJZL-YDZ2S
SFZHH-2Y246-Z483L-EU92B-LNYUA
GSZVS-5W4WA-T9F2E-L3XUX-68473
FTZ8A-R3CP8-AVHYW-KKRMQ-SYDLS
Q3ZWN-QWLZG-32G22-SCJXZ-9B5S4
DAZPH-G39D3-R4QY7-9PVAY-VQ6BU
KLZ5G-X37YY-65ZYN-EUSV7-WPPBS
@tomi500
tomi500 / extend-trial-jetbrains-windows.bat
Created October 1, 2024 06:12 — forked from rjescobar/extend-trial-jetbrains-windows.bat
JetBrains IDE trial reset windows
REM Delete eval folder with licence key and options.xml which contains a reference to it
for %%I in ("WebStorm", "IntelliJ", "CLion", "Rider", "GoLand", "PhpStorm", "Resharper", "PyCharm") do (
for /d %%a in ("%USERPROFILE%\.%%I*") do (
rd /s /q "%%a/config/eval"
del /q "%%a\config\options\other.xml"
)
)
REM Delete registry key and jetbrains folder (not sure if needet but however)
rmdir /s /q "%APPDATA%\JetBrains"
@tomi500
tomi500 / Exclude groups
Created August 6, 2024 08:04 — forked from lukecav/Exclude groups
Groups to exclude in Redis object caching for LearnDash
comment
counts
plugins
learndash_reports
learndash_admin_profile
wc_session_id
@tomi500
tomi500 / elementor_activator.php
Created June 14, 2024 08:54 — forked from lupetalo/elementor_activator.php
Elementor Activator
<?php
/**
* Plugin Name: Elementor Activation
* Description: Activates Elementor Pro - Not everybody have shell acces to run WP CLI or desire for eveybody to see license key. Manual activation is needed, and since Elementor wont add this, community will :)
* Plugin URI: https://github.com/elementor/elementor/issues/8667
* Gist Plugin URI: https://gist.github.com/lupetalo/38e6d40b620b7da976c42c2d207c674a
* Version: 1.3
*/
add_filter('pre_http_request', function($request, $request_params, $url){
if (strpos($url, 'my.elementor.com/api/v2/license/')!==false){
@tomi500
tomi500 / Visual Studio 2022 Product Key
Created May 21, 2024 05:54
Visual Studio 2022 Enterprise Product key
Visual Studio 2022
Enterprise :
VHF9H-NXBBB-638P6-6JHCY-88JWH
Professional:
TD244-P4NB7-YQ6XK-Y8MMM-YWV2J
/**
* Returns an string clean of UTF8 characters. It will convert them to a similar ASCII character
* www.unexpectedit.com
*/
function cleanString($text) {
// 1) convert á ô => a o
$text = preg_replace("/[áàâãªä]/u","a",$text);
$text = preg_replace("/[ÁÀÂÃÄ]/u","A",$text);
$text = preg_replace("/[ÍÌÎÏ]/u","I",$text);
$text = preg_replace("/[íìîï]/u","i",$text);
@tomi500
tomi500 / gist:9c75fa3ae20f8407f3f92b05a3732f25
Created April 30, 2021 07:34 — forked from kgaughan/gist:4492913
UTF-8 to ASCII transliteration in PHP (for, say, accent removal)
<?php
$ascii = iconv('utf8', 'ascii//TRANSLIT', $utf8)
@tomi500
tomi500 / wp-remove-default-image-sizes.php
Created April 2, 2021 09:40 — forked from iftee/wp-remove-default-image-sizes.php
Custom filter to remove default image sizes (WordPress and WooCommerce) from your theme.
<?php
/*
* Custom filter to remove default image sizes from WordPress.
*/
/* Add the following code in the theme's functions.php and disable any unset function as required */
function remove_default_image_sizes( $sizes ) {
/* Default WordPress */
unset( $sizes[ 'thumbnail' ]); // Remove Thumbnail (150 x 150 hard cropped)