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
#debian #supervisor #super #systemctl #bot #superpupper

Supervisor installation & configuration:

sudo apt update && sudo apt install supervisor


sudo systemctl status supervisor


sudo nano /etc/supervisor/conf.d/bot.conf


[program:bot]
command=/var/www/bot.sh
autostart=true
autorestart=true
stderr_logfile=/var/log/bot.err.log
stdout_logfile=/var/log/bot.out.log


sudo chmod +x /var/www/bot.sh


sudo supervisorctl
sudo supervisorctl stop
sudo supervisorctl start
sudo supervisorctl reread
sudo supervisorctl restart
sudo supervisorctl update
Reconfigure Locales on Debian Server:

dpkg-reconfigure locales


#debian #locales #server #кракозябры #characters #кодировка #encoding
Some docker PHP container errors:

Error:
=> ERROR [php stage-0 5/9] RUN docker-php-ext-install curl
...
1.877 configure: error: Package requirements (libcurl >= 7.29.0) were not met:
...

Solution:
RUN apt -y install libcurl4-openssl-dev


Error:
=> ERROR [php stage-0  8/10] RUN docker-php-ext-install pdo_pgsql
...
1.853 configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
...

Solution:
RUN apt -y install libpq-dev


Error:
 => ERROR [php stage-0  9/10] RUN docker-php-ext-install zip
...
1.930 configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
...

Solution:
RUN apt -y install libzip-dev


Error:
 => ERROR [php stage-0 11/11] RUN docker-php-ext-install mbstring
...
1.758 configure: error: Package requirements (oniguruma) were not met:
...

Solution:
RUN apt -y install libonig-dev


#docker #php #error #errors #dockerfile
Bash script automatically execution after system startup on your Xubuntu system:

cd ~
nano bootstrap.sh

nohup "/home/roman/.local/share/JetBrains/Toolbox/apps/phpstorm/bin/phpstorm.sh" > /dev/null 2> /dev/null &
nohup "google-chrome-stable" > /dev/null 2> /dev/null &
nohup "/opt/Telegram/Telegram" > /dev/null 2> /dev/null &

sudo chmod 777 bootstrap.sh


🖱 Menu
Session and Startup
Application Autostart
Fill name, description & command
/home/roman/bootstrap.sh 

Add & Close

#xubuntu #autostart #linux #bash #autostart #startup
Please open Telegram to view this post
VIEW IN TELEGRAM
In Docker Alpine gulp trouble:

Error:

npm ERR! gyp verb which failed Error: not found: python2


Solution:
apk update
apk add python
npm config set python $(which python)


#docker #alpine #npm #node #python
🖥 Fix permissions troubles: 🖥

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


Docker Container: Debian 12 (bookworm)

Dockerfile:
FROM node:21.6.2-bookworm

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

RUN echo "node:root" | chpasswd && usermod -aG sudo node

# Other RUN instructions ...

USER node


#docker #fix #php #dockerfile #chmod
Please open Telegram to view this post
VIEW IN TELEGRAM
🤝1
Is it good new PhpStorm EAP feature?
Tampermonkey take page screenshot button:

// ==UserScript==
// @name Screenshot Downloader
// @namespace http://your.namespace.com
// @version 1.0
// @description Take a screenshot and download it as an image
// @include *://*/*
// @grant GM_download
// @require https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js
// ==/UserScript==

(function() {
'use strict';

// Function to convert the screenshot to a base64 image
function takeScreenshotAndDownload() {
html2canvas(document.body, {
onrendered: function(canvas) {
var screenshotUrl = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
GM_download({
url: screenshotUrl,
name: 'screenshot.png'
});
}
});
}

// Add a button to trigger the screenshot download
var button = document.createElement('button');
button.innerText = 'Photo';
button.onclick = takeScreenshotAndDownload;
button.style.position = 'absolute';
button.style.top = '70px';
button.style.right = '50px';
document.body.appendChild(button);
})();
Nginx block access to .hidden files:

server {
# ...
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# ...
}

#nginx #config #server #security #hidden
👍1🔥1
Users will test 🤪🤣🥳
Please open Telegram to view this post
VIEW IN TELEGRAM
👍1
🧢 How to Connect Bluetooth Headphones in Terminal 🎛

sudo yum install bluez || sudo apt install bluez

bluetoothctl connect A1:B2:C3:E4:F5:G6 # MAC Address


#bluetooth #headphones #bluez #bluetoothctl
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 How to Import *.gz MySQL Database Backup 🖥

zcat backup.sql.1996-11-30.gz | mysql -uuser_root -hhost_mysql -ppassword database_name


#backup #mysql #mariadb #gz #database
Please open Telegram to view this post
VIEW IN TELEGRAM
Get Time Zone:

date +"%Z %z"


Change Time Zone:

sudo apt update && sudo apt upgrade && reboot


🤪🤣🥳

#time #date #timezone #datetime
Please open Telegram to view this post
VIEW IN TELEGRAM
🈂️ Disable Apache2 Auto Start

sudo update-rc.d apache2 disable


#autostart #apache #apache2
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 Bluetooth Headphones Pause = Next Track
Workaround Yandex Music Script
☯️

    setInterval(() => {
navigator.mediaSession.setActionHandler("pause", (details) => {
const nextButton = document.getElementsByClassName('d-icon d-icon_track-next')[0];
if (nextButton) {
nextButton.click();
console.log('Clicked on the next button successfully.');
} else {
console.log('Element not found. Make sure the class selector is correct.');
}
console.log('Pause');
});
}, 1);


🖥 Tampermonkey Script 🫔

#yandex #music #js #tampermonkey #workaround #bluetooth #pause
Please open Telegram to view this post
VIEW IN TELEGRAM
1🔥1
🖥 Rollback File Permissions for Unchanged Files

echo "Enter your slave branch:"
read your_branch
echo "Enter your main branch:"
read master_branch
changes=$(git --no-pager diff --name-only "$master_branch" "$your_branch")
while IFS= read -r file;
do
file_changes=$(git --no-pager diff "$master_branch" "$your_branch" -- "$file")
line_count=$(echo "$file_changes" | wc -l)
if [ "$line_count" -eq 3 ]; then
line2=$(echo "$file_changes" | sed -n '2p') # Get the second line
line3=$(echo "$file_changes" | sed -n '3p') # Get the third line
if [[ "$line2" == "old mode"* ]] && [[ "$line3" == "new mode"* ]]; then
chmod -x "$file"
fi
fi

done <<< "$changes"

echo "Success! Happy codding!"


Fast execution:
curl -so fix-git-mode.sh https://gist.githubusercontent.com/makhnanov/275672ed5d139170d62d338ddf18faab/raw/abf3998b9198b64962c4e3e9ec5aa4e4e532018a/fix-git-mode.sh && chmod +x fix-git-mode.sh && ./fix-git-mode.sh && rm fix-git-mode.sh


🐱Snippet

#permission #mode #chmod #git #rollback
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 Install Node Version Manager 🎛

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.bashrc
nvm i node


Alternative:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

nvm install 20.16.0


Check Current NodeJS Versions

#js #javascript #nvm #npm #node
Please open Telegram to view this post
VIEW IN TELEGRAM
❄️ Show Weather Forecast in Terminal Every Opening ☀️

sudo bash -c 'echo "curl wttr.in/Almaty" >> /etc/bash.bashrc'


#bash #curl #wttr #weather #forecat #bashrc
Please open Telegram to view this post
VIEW IN TELEGRAM