Skip to content

Instantly share code, notes, and snippets.

View webarchitect609's full-sized avatar

Gripinskiy Sergey webarchitect609

View GitHub Profile
@webarchitect609
webarchitect609 / git_gpg_signing.sh
Created February 13, 2022 20:04
Disable or enable GPG signing for git repo
# Globally enable gpg signing.
# Now you will be forced to decide should you disable or enable gpg signing feature for each repo.
# If you don't do anything, making a commit will be impossible.
git config --global commit.gpgsign true
# Disable GPG-signing for this repo only
git config --local commit.gpgsign false
# Enable GPG-signing for this repo only by setting the GPG key id
git config --local user.signingkey $KEY_ID
@webarchitect609
webarchitect609 / bitrix_catalog_integrity_check.sql
Last active December 21, 2021 08:58
Контроль целостности торгового каталога Битрикс
-- Контроль целостности торгового каталога Битрикса: найти отсутствующие сущности "продукт"
SELECT E.IBLOCK_ID AS IblockId,
E.ID AS ElementId,
E.NAME AS ElementName,
E.ACTIVE AS ElementActive,
CP.ID,
CP.TYPE
FROM b_catalog_iblock AS CI
INNER JOIN b_iblock_element AS E ON E.IBLOCK_ID = CI.IBLOCK_ID
@webarchitect609
webarchitect609 / phiremock_rules_naming_protocol.md
Last active November 23, 2021 10:13
Регламент именования правил Phiremock

Регламент именования правил Phiremock

Уровень 1: сервис

Следует кратко указать имя сервиса в имени раздела.

Например, https://partners.delivery-club.ru это партнёрское API Delivery Club. Значит папка будет называться partners_delivery_club.

@webarchitect609
webarchitect609 / mysql_delete_bitrix_user_personal_data.sql
Created November 1, 2021 14:10
Удаляет персональные данные Битрикс пользователей
-- Собрать id пользователей, данные которых требуется сохранить.
-- (вместо "ID not in(6)" следует описать условие выборки групп пользователей для сохранения)
create temporary table if not exists `tmp_keep_users_id_list` (`ID` int(18) NOT NULL);
truncate `tmp_keep_users_id_list`;
insert into `tmp_keep_users_id_list` (
select U.ID
from b_user as U
inner join b_user_group as UG
on U.ID = UG.USER_ID
where
@webarchitect609
webarchitect609 / mysql_delete_all_tables_at_once.sh
Last active January 27, 2022 15:45
Delete all the tables in MySQL database in one command
# WARNING!!! This is VERY DANGEROUS command!
# Deletes ALL TABLES in $DBNAME database QUICKLY and IRREVERSIBLY!
mysql -h $DBHOST -u $DBUSER $DBNAME -p \
-BNe 'show tables' \
| tr '\n' ',' \
| sed -e 's#,$##' \
| sed -e 'i\/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;' \
-e 'i\DROP TABLE IF EXISTS ' \
-e 'a\;' \
-e 'a\/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;' \
@webarchitect609
webarchitect609 / gpg_encrypt.sh
Created May 17, 2021 15:42
Отправить мне зашифрованное сообщение | Send me encrypted message
# Должен быть установлен GnuPG
# GnuPG must be installed
# Импортировать мой публичный ключ с сервера
# Import my public key from the server
gpg --auto-key-locate hkps://keys.openpgp.org --locate-keys web-architect@mail.ru
# Получить список всех публичных ключей с идентификаторами.
# List all public keys with IDs
gpg --list-public-keys --keyid-format LONG
@webarchitect609
webarchitect609 / regexp.txt
Last active February 12, 2021 10:05
Convert a list of composer packages from composer.json to the `composer install` command line arguments
# Find
("[^"]+":)\s+("[^"]+")\n
# Replace(with the space at the end!)
$1$2
# Example
# Before:
@webarchitect609
webarchitect609 / jira_inline_image.md
Last active October 10, 2023 11:24
Inline images for Jira markup

Inline image as is

Find:

http(s)?:\/\/[^\s]+\.(gif|png|jpg|jpeg)

Replace:

[!$0!|$0]
@webarchitect609
webarchitect609 / php8_docker.sh
Last active April 15, 2023 14:31
Quick docker PHP 8 setup for composer and unit testing
# Terminal Tab #1 (with privileges inside container)
# =============
cd "/the/dir/you/want/to/work/with/php8"
docker run --name php8 \
-it \
-v $PWD:/var/php:rw \
php:8.0-cli-alpine3.12 \
ash
cd /tmp
@webarchitect609
webarchitect609 / terminal.sh
Last active April 25, 2024 15:07
Git: disable GPG signing for current repo only.
# Write local
git config --local commit.gpgsign false
# Read local (if never set, can be an empty value)
git config --local commit.gpgsign