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
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
This media is not supported in your browser
VIEW IN TELEGRAM
PhpStorm 2024.1 EAP Terminal Update:

#JetBrains #PhpStorm #php #terminal #update #version #peek
๐Ÿ”ฅ1
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
๐Ÿ–ฑ Xubuntu Fast Switch Between Applications

In Different Displays: Alt + Tab
In One Display: Alt + Middle Click

#hotkey #xubuntu #mouse #xfce
Please open Telegram to view this post
VIEW IN TELEGRAM
JavaScript create alias for any function ๐Ÿ–ฅ

if (!String.prototype.contains) {
// Provide an alias to 'includes' for older browsers
String.prototype.contains = function(search) {
return this.includes(search);
};
}

// Test the polyfilled 'contains' method
const str = "Hello, World!";
console.log(str.contains("Hello")); // Outputs: true
console.log(str.contains("JavaScript")); // Outputs: false


#js #javascript #includes #contains #alias #frontend
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿคฃ1