Skip to content

Instantly share code, notes, and snippets.

@voidvn
voidvn / gist:d721baf14464a53d58db4f0842fab3db
Created June 19, 2023 10:15
Deepin Linux. Set shortcut for Deepin color picker tool
# install deepin-picker package (sudo apt install deepin-picker)
# open keyboard settings -> go to shortcuts -> add new shortcut
set name - Color picker
set command - deepin-picker
set shortcut - Shift + Ctrl + P
# ready, press combination and start picking colors
@voidvn
voidvn / TestModel.php
Last active June 18, 2023 16:12
Fix for saving non-unicode characters in the database json field for Laravel Model Class (saves characters like that \u1234 in normal form)
/**
* @throws JsonException
*/
protected function asJson($value): bool|string
{
return json_encode($value, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
}
@voidvn
voidvn / git-clone-remote-branch.sh
Created June 12, 2023 20:00
Git cli command to clone remote branch
git clone --branch <branchname> <remote-repo-url>
@voidvn
voidvn / git-remove-cached.sh
Created June 12, 2023 19:39
The Git command removes files from indexing, but leaves them in the working directory.
# git rm --cached -r {folder}
git rm --cached -r .idea/
@voidvn
voidvn / show-container-logs.sh
Created June 12, 2023 19:34
Command to show last 10 rows of docker container, in real time
docker logs -f --tail 10 {container_name}
@voidvn
voidvn / php-memoty-limit.sh
Created June 9, 2023 15:12
Check PHP memory limit value
php -r "echo ini_get('memory_limit').PHP_EOL;"
@voidvn
voidvn / gist:2bcb2a1cbc7545316ba295d52fa33606
Created June 6, 2023 09:26
Link to setup webhook for your Telegram Bot
https://api.telegram.org/bot{BOT-TOKEN}/setWebhook?url=https://{WEBSITE-DOMAIN}/api/telegram-bot/{BOT-TOKEN}/webhook
@voidvn
voidvn / docker-clear.sh
Created June 5, 2023 14:47
Stop and clear all docker containers and images on the server
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
# check free space
df -h
@voidvn
voidvn / bitrix-auth.php
Last active June 2, 2023 21:25
Bitrix auth script (if you don't know admin password). Create this file in the site root directory.
<?php
require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/header.php');
global $USER;
// auth user with id = 1
$USER->Authorize(1);
// delete this script from server
@unlink(__FILE__);
@voidvn
voidvn / google-chrome-disable-web-security.sh
Created May 25, 2023 20:20
Linux terminal command to launch Google Chrome with disabled web-security flag(use to avoid CORS errors)
# in user data dir spicify your home folder or other dir
google-chrome --disable-web-security --user-data-dir=/home/void/