Category Archives: sadmin

sadmin

Laravel vs Core PHP vs Core PHP +Smarty

Core PHP + Smarty -- the Winner

Направихме един малък тест за бързодействие на
Laravel vs (Core PHP + Smarty) vs Core PHP

Очакван резултат, но все пак извод:
CorePHP е топ за супер натоварени сайтове където се гони абсолютен оптимум, а не просто да работи и да се купуват железа безкрай.
+ и -- на Laravel са ясни. Идеята тук е бързодействие, а със Smarty се получава и разделение на front, back.
Всеки проект и ситуация определя какво да се ползва: Laravel, друг framework, Core PHP или друго…
PS0: За тестовете бяха направени три контейнера с абсолютно еднакви параметри на дистро,пакети/apache+nginx proxy+mariadb/,страниците извършиха един и същи брой заявки към db и т.н.
Всичко се изпълни локално в конкретните контейнери/ясно е защо/
Ползван беше apache bench tool: ab -n 10000 -c 200 https://example.com

Ето ги и резултатите:

laravel_vs_core_php_vs_smarty

#Core PHP # > ab -n 10000 -c 100 https://example.com

Server Software: nginx/1.18.0
Document Length: 35030 bytes

Concurrency Level: 100
Time taken for tests: 23.690 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 354230000 bytes
HTML transferred: 350300000 bytes
Requests per second: 389.26 [#/sec] (mean)
Time per request: 256.898 [ms] (mean)
Time per request: 2.569 [ms] (mean, across all concurrent requests)
Transfer rate: 13465.55 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 5 94 43.1 85 373
Processing: 10 161 58.1 154 439
Waiting: 7 79 55.1 67 337
Total: 14 255 73.1 247 581

#######################################################################
#Core PHP + Smarty# >

Concurrency Level: 100
Time taken for tests: 2.585 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 29295000 bytes
HTML transferred: 28902000 bytes
Requests per second: 386.82 [#/sec] (mean)
Time per request: 258.516 [ms] (mean)
Time per request: 2.585 [ms] (mean, across all concurrent requests)
Transfer rate: 11066.38 [Kbytes/sec] received

#######################################################################
#Laravel

Concurrency Level: 100
Time taken for tests: 3.483 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 39052000 bytes
HTML transferred: 37818000 bytes
Requests per second: 287.10 [#/sec] (mean)
Time per request: 348.309 [ms] (mean)
Time per request: 3.483 [ms] (mean, across all concurrent requests)
Transfer rate: 10949.12 [Kbytes/sec] received

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Проблем с apache: Set the 'ServerName' directive globally to suppress this message

# apache2ctl -t
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

/etc/apache2/apache2.conf

ServerName 127.0.0.1

#/etc/init.d/apache2 restart
[ ok ] Restarting apache2 (via systemctl): apache2.service.

# apache2ctl -t
Syntax OK

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

При интервал в url-то на Apache се връща грешка 403 -- Forbidden

От версия 2.4.56 на Apache има фикс "Apache HTTP Server: HTTP request splitting with mod_rewrite and mod_proxy" (CVE-2023-25690)" където всички интервали в урл-тата ще връщат 403

За да се фиксне се доабвят флаговете BCTLS или B към текущите флагове,
т.е.

Пример:
RewriteRule ^primer$ /h_primeren_file.php [QSA,L]

Пренаписва се така:

RewriteRule ^primer$ /h_primeren_file.php [BCTL,QSA,L]

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Показване на wifi паролите на Windows 10

netsh

netsh>wlan show profile

Profiles on interface Wi-Fi:

Group policy profiles (read only)
---------------------------------

User profiles
-------------
All User Profile : wifi_network

netsh>wlan show profile "amri" key=clear

Profile amri on interface Wi-Fi:
=======================================================================

Applied: All User Profile

Profile information
-------------------
Version : 1
Type : Wireless LAN
Name : wifi_network
Control options :
Connection mode : Connect automatically
Network broadcast : Connect only if this network is broadcasting
AutoSwitch : Do not switch to other networks
MAC Randomization : Disabled

Connectivity settings
---------------------
Number of SSIDs : 1
SSID name : "wifi_network"
Network type : Infrastructure
Radio type : [ Any Radio Type ]
Vendor extension : Not present

Security settings
-----------------
Authentication : WPA2-Personal
Cipher : CCMP
Authentication : WPA2-Personal
Cipher : GCMP
Security key : Present
Key Content : super_wifi_pass

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Конвертиране от proxmox lxc към lxd

cd /tmp
pct list

vzdump 103 -compress gzip -dumpdir /tmp
echo architecture: `pct config 103 | grep arch: | awk '{print $2}' ` > metadata.yaml
echo creation_date: `date +%s` >> metadata.yaml
echo description: 'Imported from Proxmox/amri' >> metadata.yaml
tar -czvf metadata.tar.gz metadata.yaml

scp vzdump-lxc-103-2024_01_23-19_06_30.tar.gz metadata.tar.gz [email protected]:/home/amri/

lxc launch fromproxmox Test -c boot.autostart=true

lxc image import --alias=fromproxmox metadata.tar.gz vzdump-lxc-103-2024_01_23-19_06_30.tar.gz

lxc image list

Източник: https://discussion.scottibyte.com/t/replace-proxmox-lxc-containers-with-lxd-containers/247

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

APT sources.list за всяка Debian версия

debian-linux

Debian 8 (Jessie)
Оригинално хранилище:

deb http://deb.debian.org/debian/ jessie main contrib non-free
deb http://ftp.debian.org/debian/ jessie-updates main contrib
deb http://security.debian.org/ jessie/updates main contrib non-free

Архивирано хранилище:

deb http://archive.debian.org/debian/ jessie main contrib non-free
deb http://archive.debian.org/debian-security jessie/updates main contrib non-free

Debian 9 (Stretch)
Оригинално хранилище:

deb http://deb.debian.org/debian/ stretch main contrib non-free
deb http://deb.debian.org/debian/ stretch-updates main contrib non-free
deb http://security.debian.org/ stretch/updates main contrib non-free

Архивирано хранилище (анонсирано на 27.03.2023):

deb http://archive.debian.org/debian/ stretch main contrib non-free
deb http://archive.debian.org/debian/ stretch-proposed-updates main contrib non-free
deb http://archive.debian.org/debian-security stretch/updates main contrib non-free

Debian 10 (Buster)
Оригинално хранилище:

deb http://deb.debian.org/debian/ buster main non-free contrib
deb http://deb.debian.org/debian/ buster-updates main non-free contrib
deb http://security.debian.org/ buster/updates main non-free contrib

Debian 11 (Bullseye)
Оригинално хранилище:

deb http://deb.debian.org/debian bullseye main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb http://security.debian.org/debian-security bullseye-security main contrib non-free

Debian 12 (Bookworm)
Оригинално хранилище:

deb http://deb.debian.org/debian bookworm main contrib non-free-firmware non-free
deb http://deb.debian.org/debian bookworm-updates main contrib non-free-firmware non-free
deb http://security.debian.org/debian-security bookworm-security main contrib non-free-firmware non-free

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

(GNU/Linux > exiftool) Синхронизация на FileModifyDate със DateTimeOriginal от EXIF на изображенията

Изтеглих архив на всичките снимки от g drive, обаче датата която сетна на снимките е датата на генериране на архива, което е изкл. трудно за сортиране понеже са с една и съща дата.

За щастие истинската дата на създаване се пази в EXIF-а на всяко изображение. За целта ще синхронизираме FileModifyDate със DateTimeOriginal и всичко ще се нормализира ;)

exiftool "-DateTimeOriginal>FileModifyDate" -ext jpg . -L -r

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Монтиране на ssh fs на Windows :(

Идеята е на Windboze машинка да се монтира отдалечено ssh като локална папка за по- лесна работа:

1. WinFsp 2022 > https://github.com/winfsp/winfsp/releases
2. SSHFS-Win > https://github.com/winfsp/sshfs-win/releases
3. SSHFS-Win Manager > https://github.com/evsar3/sshfs-win-manager/releases

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Смяна на админ парола / Prestashop 1.7 / през mysql (забравен администратор)

prestashop_promqna_parola_mysql

Бях забравил паролата на админа през уеб и се наложи да я променя.

grep "'cookie_key'" app/config/parameters.php

'cookie_key' => '9za9dj7PjItOpgfMTz7dVAoE4rX0s0GcedADKDN5Oh7cUBAdqysrv6wGVXyyqk9C',

UPDATE `ps_employee` SET `passwd` = MD5('COOKIE_KEY + PASSWORD ') WHERE `ps_employee`.`id_employee` = 1;

MariaDB [dev]> UPDATE `ps_employee` SET `passwd` = MD5('9za9dj7PjItOpgfMTz7dVAoE4rX0s0GcedADKDN5Oh7cUBAdqysrv6wGVXyyqk9CPAROLATA') WHERE `ps_employee`.`id_employee` = 1;

PS: Така и не ми остава време да си сложа моята система за блог да не ползвам тоя бълвоч WP

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Facebook умря :) (Проблем с DNS-те) -- Проблема не е във Вашия телевизор

Преди час някъде спря Facebook и то под спиране се разбира, че не се резолва facebook.com Проблема не е във Вашият Интернет Доставчик!
Направих тестове с днс-те на моя доставчик, Бергон, на Добруджа Кабел и на няколко публични днс-и. Излезе, че никъде не се резолва освен в opendns.
Ето ги и тестовете с резултата

> Google DNS:
amri@:~$ dig @8.8.8.8 facebook.com|grep "IN"|grep 0
NOT FOUND

amri@:~$ dig @8.8.4.4 facebook.com|grep "IN"|grep 0
NOT FOUND

> CloudFlare DNS
amri@:~$ dig @1.1.1.1 facebook.com|grep "IN"|grep 0
NOT FOUND

> ISP Bergon
amri@:~$ dig @109.104.192.1 facebook.com|grep "IN"|grep 0
NOT FOUND

amri@:~$ dig @109.104.192.2 facebook.com|grep "IN"|grep 0
NOT FOUND

> OpenDNS
amri@:~$ dig @208.67.220.222 facebook.com|grep "IN"|grep 0
facebook.com. 0 IN A 157.240.199.35
FOUND

amri@:~$ dig @208.67.220.220 facebook.com|grep "IN"|grep 0
facebook.com. 0 IN A 157.240.12.35
FOUND

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)