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 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)
#linux #boot #apt #kernel

Current Linux Kernel:

uname -r

5.10.0-23-amd64

Show Installed Kernels:
dpkg -l | grep linux-image | awk '{print$2}'

linux-image-5.10.0-12-amd64
linux-image-5.10.0-23-amd64
linux-image-5.10.0-26-amd64
linux-image-5.10.0-28-amd64
linux-image-amd64


Problem:
apt upgrade

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up linux-image-5.10.0-28-amd64 (5.10.209-2) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.10.0-28-amd64
pigz: abort: write error on <stdout> (No space left on device)
E: mkinitramfs failure pigz 28
update-initramfs: failed for /boot/initrd.img-5.10.0-28-amd64 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.10.0-28-amd64 (--configure):
installed linux-image-5.10.0-28-amd64 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-amd64:
linux-image-amd64 depends on linux-image-5.10.0-28-amd64 (= 5.10.209-2); however:
Package linux-image-5.10.0-28-amd64 is not configured yet.

dpkg: error processing package linux-image-amd64 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
linux-image-5.10.0-28-amd64
linux-image-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)


Solution:
apt remove --purge linux-image-5.10.0-12-amd64

or
sudo apt-get autoremove --purge

dpkg -l 'linux-image-*' | awk '{ if ($1 == "ii") print $2}' | grep -v $(uname -r | grep -o '^[^-]*-[^-]*') | xargs sudo apt-get -y purge


#image #core #mkinitramfs #failure #pigz
#ubuntu #debian #xubuntu #sources #repositories

Edit sources:
sudo nano /etc/apt/sources.list

alias sources='sudo nano /etc/apt/sources.list'


Other sources directory:
sudo mc /etc/apt/sources.list.d