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
Git Post Push Emulation

nano .git/hooks/pre-push


#!/bin/bash
# .git/hooks/pre-push

unset SSH_ASKPASS
unset SSH_ASKPASS_REQUIRE

notify-send \
--urgency=normal \
--expire-time=8000 \
--icon=emblem-ok \
--category=transfer.complete \
"Git Push Started"

remote="$1"
url="$2"

while read local_ref local_sha remote_ref remote_sha
do
branch=$(basename "$local_ref")

(
start_time=$(date +%s)

# Ждём завершения push
while pgrep -P $PPID "git" >/dev/null 2>&1; do
sleep 0.3
done

sleep 1.5

end_time=$(date +%s)
duration=$((end_time - start_time))

commits_count=$(git rev-list --count "$remote_sha..$local_sha" 2>/dev/null || echo "unknown")

details="Branch: $branch\nRemote: $remote\nCommits: $commits_count\nDuration: ${duration}s"

notify-send \
--urgency=normal \
--expire-time=8000 \
--icon=emblem-ok \
--category=transfer.complete \
"Git Push Complete" \
"$details"

sshpass -p 123Pass ssh root@8.8.8.8 "cd /var/www/portfolio/ && git pull"
status=$?

if [ $status -eq 0 ]; then
notify-send \
--urgency=normal \
--icon=emblem-default \
"Git: Деплой успешен" \
"Коммиты отправлены и pull успешно выполнен."
else
notify-send \
--urgency=critical \
--icon=dialog-error \
"Git: Ошибка деплоя" \
"ssh завершился с кодом $status.\nПроверь соединение или пароль."
fi

) 2>/dev/null &

disown
done

exit 0


chmod +x .git/hooks/pre-push


#git #hook #prepush #postpush
Inkscape Make Center

Ctrl + Shift + A


#svg
👍1
Debian 12 (bookworm)
Install PHP 8.4

sudo apt update
sudo apt install apt-transport-https lsb-release ca-certificates curl -y
sudo curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt update
sudo apt install php8.4
php -v
sudo apt install php8.4-cli php8.4-fpm php8.4-mysql php8.4-curl php8.4-gd php8.4-xml php8.4-zip php8.4-mbstring php8.4-xml php8.4-gmp php8.4-pgsql


sudo systemctl stop apache2
sudo systemctl disable apache2
sudo apt remove apache2 apache2-bin apache2-common apache2-data -y
sudo apt autoremove -y
apache2 -v
sudo apt purge apache2* -y
sudo rm -rf /etc/apache2


sudo -u postgres pg_dump database_name > backup.sql

scp backup.sql user@second_server:/home/debian/

sudo -u postgres psql database_name < /home/debian/backup.sql

nano /etc/postgresql/*/main/pg_hba.conf
host all all 0.0.0.0/0 scram-sha-256

sudo nano /etc/postgresql/*/main/postgresql.conf
port = 5433

sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/*/main/postgresql.conf

sudo ufw allow 5559/tcp
// ==UserScript==
// @name Auto Refresh Page
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Обновляет страницу каждые 10 секунд
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==

(function() {
'use strict';
setTimeout(() => {
location.href = location.href.split('?')[0] + '?nocache=' + Date.now();
}, 10000);
})();
alias gt='git-tag'
alias git-tag="git --no-pager tag | sort -V"
Steam Down
alias my-ip='curl ifconfig.io'
df -h
ncdu