Smart 🧠 Fullstack
45 subscribers
168 photos
11 videos
13 files
153 links
About channel: everyday developer hints.

for (💲Coders as 💲Student):
echo("Hello 💲Student->name");
endfor;

Author: @BakirovRoman
Download Telegram
Forwarded from RESTful api
Docker commands cheat sheet
👍1
#PHP #PhpStorm #warning

Multiple definitions exist for class 'Throwable'


1️⃣ Every time:
/** @noinspection PhpMultipleClassDeclarationsInspection */


2️⃣ Once:
1) Ctrl + Click
2) Project ➡️ Select Opened File
3) Right Click
4) Override File Type ➡️ Plain Text
Forwarded from QA Family by Alexey (Alexey)
This media is not supported in the widget
VIEW IN TELEGRAM
Close port. Also block docker expose ports.
nmap -p- 1.2.3.4

echo "{ \"iptables\" : false }" > /etc/docker/daemon.json
service docker restart
ufw deny 5432 && ufw reload

#debian #nmap #ufw #docker
1
Forwarded from Laravel World
Laravel немного ускоряется при переходе с PHP 8.1 на 8.2. А с PHP 8.3 вы получаете еще плюс 38% производительности.

https://kinsta.com/blog/php-benchmarks/
🐳1
#xDebug #PHP #fix
Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(

Fix:
# xdebug.ini
xdebug.log_level=0
Найдётся не всё 🤣🤪🤪🥳
🖥 Но скачивать всё равно можно)
Please open Telegram to view this post
VIEW IN TELEGRAM
#exitCodes #linux
shell: Error 130 = Bash script terminated by Control-C
Тык 🥳
Please open Telegram to view this post
VIEW IN TELEGRAM
👍1
🖥 Fix permissions troubles 🖥

Host: Xubuntu 23.10 (mantic)
# id
uid=1000(roman) gid=1000(roman) ...


Docker Container: Debian 12 (bookworm)

PhpDockerfile:
FROM php:8.3-fpm

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

RUN apt-get update && apt-get install sudo

RUN groupadd -g 1000 mygroup && \
useradd -u 1000 -g 1000 -m roman && \
echo "roman:root" | chpasswd && \
usermod -aG sudo roman

# Other RUN instructions ...

USER roman


#docker #fix #php #dockerfile #chmod #sponsor

💎 Sponsored
Please open Telegram to view this post
VIEW IN TELEGRAM
#PHP #Laravel #Orchid #admin #docker

Fix docker host.docker.internal in URLs in Orchid admin panel:

RouteServiceProvider.php
    public function boot(): void
{
URL::forceRootUrl(getenv('APP_URL'));
#PHP #Laravel #Orchid #admin

Override std user model:

PlatformProvider.php
    public function boot(Dashboard $dashboard): void
{
Dashboard::useModel(
\Orchid\Platform\Models\User::class,
\App\Models\OrchidUser::class
);
#linux #ping #workaround #mobile #usb #internet #wifi #ttl

Bypassing the blocking of the mobile operator internet distribution.

sudo sysctl -w net.ipv4.ip_default_ttl=65


LosstPro
Linux Nano Hotkeys:

Ctrl + Delete ➡️ Drop Next Word
Alt + Backspace ➡️ Drop Previous Word
Ctrl + L ➡️ Refresh Screen
Ctrl + K ➡️ Drop Current Line
Shift + Arrows ➡️ Select Text
Ctrl + K ➡️ Cut Selected
Ctrl + U ➡️ Paste
Ctrl + 6 ➡️ Set Mark
Shift + Arrows ➡️ Select Text
Alt + 6 ➡️ Unset Mark / Copy
Ctrl + U ➡️ Paste
Alt + 3 ➡️ Comment
Alt + U ➡️ Ctrl + Z (Undo)
Alt + E ➡️ Redo
Alt + N ➡️ Show line number
Ctrl + O / Ctrl + S ➡️ Save
Ctrl + X ➡️ Save & Exit
Ctrl + W ➡️ Write text for search, then Enter.
For next occurrence just Ctrl + W and Enter

#bash #nano #linux
#bash #linux #debian #root #sudo

How to ignore sudo in commands on server (if only root user exists):

Problem:
root@mx1:~# sudo nano somefile.txt
-bash: sudo: command not found


nano /etc/bash.bashrc


Before:
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
function command_not_found_handle {
# check because c-n-f could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/lib/command-not-found -- "$1"
return $?
elif [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/share/command-not-found/command-not-found -- "$1"
return $?
else
printf "%s: command not found\n" "$1" >&2
return 127
fi
}
fi


After:
function command_not_found_handle {
# check because c-n-f could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/lib/command-not-found -- "$1"
return $?
elif [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/share/command-not-found/command-not-found -- "$1"
return $?
else
if [ "$EUID" -eq 0 ] && [[ $1 == sudo* ]]; then
full_command="$0 $@"
drop_sudo="${full_command#-}"
drop_sudo="${drop_sudo#bash}"
drop_sudo="${drop_sudo# }"
drop_sudo="${drop_sudo#sudo}"
drop_sudo="${drop_sudo# }"
bash -c "$drop_sudo"
return $?
else
printf "%s: command not found\n" "$1" >&2
fi
return 127
fi
}


Tested on Debian 11 (bullseye)