Skip to content

Instantly share code, notes, and snippets.

@mrLexx
mrLexx / phpstorm_evaluation_license_reset.md
Created April 25, 2024 08:13 — forked from Gyvastis/phpstorm_evaluation_license_reset.md
PhpStorm reset evaluation license/period

PhpStorm reset evaluation license/period

Make sure to export/import your settings through File -> Manage IDE settings before/after

Windows 10

  1. Close PHPStorm
  2. Run these in PowerShell to remove PhpStorm configuration:
Remove-Item '.\AppData\Local\Jetbrains\PhpStorm*'
Remove-Item '.\AppData\Roaming\Jetbrains\PhpStorm*'
@mrLexx
mrLexx / memory_info.sh
Created January 24, 2024 09:05
show memory nfo
lshw -short -C memory
@mrLexx
mrLexx / git-reset-author.sh
Created August 13, 2023 18:36 — forked from bgromov/git-reset-author.sh
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\Class_\StringableForToStringRector;
@mrLexx
mrLexx / rearct-native-app-in-wsl2.md
Created April 20, 2022 07:29 — forked from bergmannjg/rearct-native-app-in-wsl2.md
Building a react native app in WSL2
= Install prython 3.10
https://computingforgeeks.com/how-to-install-python-on-ubuntu-linux-system/
sudo apt update && sudo apt upgrade -y
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.10
= install pip for p 3.10
@mrLexx
mrLexx / git_update.sh
Created April 15, 2021 06:18
git update
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
git --version
@mrLexx
mrLexx / mysql_gen_pass.sql
Last active June 4, 2020 01:01
Generate a random string in MySQL
SELECT SUBSTRING(REPLACE(REPLACE(REPLACE( TO_BASE64(MD5(RAND())), '=',''),'+',''),'/',''), 2, 8);
SELECT SUBSTRING(REPLACE(REPLACE(REPLACE( TO_BASE64(MD5(RAND())), '=',''),'+',''),'/',''), 2, FLOOR(10+RAND()*31));
@mrLexx
mrLexx / first_last_day.sql
Created April 16, 2020 11:06
First and Last day of month on mysql
select DATE_FORMAT(now(),'%Y-%m-01'),LAST_DAY(now());

Detect google and yandex search bots (crawl, spider)

function detectSearchBot($ip, $agent, &$hostname)
{
    $hostname = $ip;

    // check HTTP_USER_AGENT what not to touch gethostbyaddr in vain
    if (preg_match('/(?:google|yandex)bot/iu', $agent)) {
 // success - return host, fail - return ip or false