Skip to content

Instantly share code, notes, and snippets.

@nd3w
nd3w / install-nginx-mariadb-phpfpm-on-ubuntu-20.04.md
Last active Nov 15, 2021
How to Install Nginx, MariaDB, PHP-FPM on Ubuntu 20.04
View install-nginx-mariadb-phpfpm-on-ubuntu-20.04.md

How to Install Nginx, MariaDB, PHP-FPM on Ubuntu 20.04

This is a way to install and set up Nginx, MariaDB and PHP-FPM on Ubuntu 20.04.

NOTE: This has been prepared for ease of use in mind, not security, mostly in development machine. Please do not use these instructions to setup on a public server environment. Use other proper manuals instead.

$ sudo apt update

Nginx

@nd3w
nd3w / nginx-tips.md
Created Oct 22, 2021
Nginx Tips and Tricks
View nginx-tips.md

Version of Nginx

sudo nginx -v

Version and Enabled modules

sudo nginx -V

Configuration test

@nd3w
nd3w / linux-commands.txt
Last active Oct 20, 2021
A Collection of Useful Linux Commands
View linux-commands.txt
Backup with bunzip
tar cvfj file.tar.bz2 *
tar cvfj file.tar.bz2 /path/to/directory_to_backup/
Compress multi directories into each own compressed files
for i in */; do zip -r "${i%/}.zip" "$i"; done
for i in */; do tar -czvf "${i%/}.tar.gz" "$i"; done
for i in */; do 7z a "${i%/}.7z" "$i"; done
Untar multiple tarballs using bash for loop
@nd3w
nd3w / php-snippets.md
Last active Jul 31, 2021
PHP Snippets
View php-snippets.md

Dump all PHP variables

$all_vars = get_defined_vars();
print_r($all_vars);

Create an array for a range (e.g: array with number from 1 to 9)

$number = 9;

for ($i = 1; $i <= $number; ++$i) {
View multimedia-on-linux.md

Disabling webcam on Linux

sudo modprobe -r uvcvideo

Enabling webcam on Linux

sudo modprobe uvcvideo
@nd3w
nd3w / mysql-queries.md
Last active May 28, 2021
Collection of useful MySQL queries
View mysql-queries.md

List of table's names only

SELECT `COLUMN_NAME` 
FROM `INFORMATION_SCHEMA`.`COLUMNS` 
WHERE `TABLE_SCHEMA`='db name' 
    AND `TABLE_NAME`='table name';

Select all rows with the same value

SELECT e1.* FROM employees e1, employees e2 
@nd3w
nd3w / Youtube Iframe
Created Mar 25, 2021
Iframe without right click, etc, could be work for Youtube addresses only.
View Youtube Iframe
<iframe
id="068a380a-add0-4954-b0fb-b25884efab81"
class="c-hero-media__video js-hero-player"
data-youtube-api="https://www.youtube.com/iframe_api"
data-youtube-id="-q7UBPU0MYI"
frameborder="0"
allowfullscreen="1"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
title="YouTube video player"
width="100%"
View My Linux Setting Collection
Turn on touchpad: xinput set-prop 15 "Device Enabled" 1
Turn off touchpad: xinput set-prop 15 "Device Enabled" 0
@nd3w
nd3w / install-gimp-ppa.txt
Last active Jun 3, 2020
Install GIMP 2.10 on Ubuntu 18.04
View install-gimp-ppa.txt
Installing:
open a terminal and type:
sudo add-apt-repository ppa:otto-kesselgulasch/gimp
sudo apt-get update
sudo apt-get install gimp
Removing:
open a terminal and type:
sudo apt-get install ppa-purge
sudo ppa-purge ppa:otto-kesselgulasch/gimp
@nd3w
nd3w / xfce-panel-icon-size.md
Last active May 31, 2020
How to change XFCE panel's of notify and audio icon size
View xfce-panel-icon-size.md

This is a way to change notify and audio icon size for XFCE panel:

Create or edit ~/.config/gtk-3.0/gtk.css, and add these two selectors:

#pulseaudio-button * {
        -gtk-icon-transform: scale(.55);
}

#xfce4-notification-plugin * {