Skip to content

Instantly share code, notes, and snippets.

View ebta's full-sized avatar

Ebta Setiawan ebta

View GitHub Profile
@ebta
ebta / mysql-remote.md
Created February 7, 2022 14:27
Allow remote connection to MySQL 8

Login using SSH, then run

mysql -uroot -p

mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'YourSecurePassword';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
mysql> FLUSH PRIVILEGES;
@ebta
ebta / goaccess.md
Last active February 5, 2022 08:26
Install and Running goaccess on Ubuntu

Installation

Requirements Package

sudo apt install libncursesw5-dev libgeoip-dev libmaxminddb-dev libssl-dev

Build from latest version For example using v1.55 (check on https://goaccess.io/download )

@ebta
ebta / bash-color-tips.md
Last active May 18, 2023 09:52
Coloring Bash Terminal

Enable nano syntax highlither

find /usr/share/nano/ -iname "*.nanorc" -exec echo include {} \; >> ~/.nanorc

Printing a colored output

A script can use escape sequences to produce colored text on the terminal.

Colors for text are represented by color codes, including, reset = 0, black = 30, red = 31, green = 32, yellow = 33, blue = 34, magenta = 35, cyan = 36, and white = 37.

@ebta
ebta / onlyoffice_ce_https_certificate.md
Last active January 5, 2022 06:44
Install LetsEncrypt https certificate on OnlyOffice Docker Community Server

How to configure HTTPS with a LetsEncrypt Certificate on OnlyOffice Community Server for Docker

  1. Install OnlyOffice (if you have not already done that) Follow the steps here https://helpcenter.onlyoffice.com/server/docker/community/docker-installation.aspx

  2. Connect to your machine with SSH, and Switch to the super-user with the command: sudo -i

  3. Create your OnlyOffice certificate folder with the command: mkdir -p /app/onlyoffice/CommunityServer/data/certs

@ebta
ebta / CI_NginX_php-FPM.md
Created December 20, 2021 04:39
Setting CI App on Subdirectory Using Nginx and PHP-FPM

Update your application conf (nginx.conf), for example your CI application in this URL https://example.com/ci-app

...
client_max_body_size 100m;
...
location /ci-app {
    try_files $uri $uri/ /ci-app/index.php;

    location ~ \.php$ {
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
@ebta
ebta / node-tips.md
Created November 27, 2021 09:16
NodeJs Application Tips

Problem FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Solution Increase memory usage for your app, for example increase to 8GB

node --max-old-space-size=8192 app.js
@ebta
ebta / php-fpm-pools-optimize.md
Last active March 3, 2023 03:31 — forked from holmberd/php-pools.md
Adjusting (Optimizing) child processes for php fpm pools (Nginx) - PHP 7.4

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@ebta
ebta / load-data-local.md
Last active November 11, 2021 07:13
Load Data [local] infile Mysql import from csv

First, accesss mysql command line using user and password :

mysql -u user -p

Run from mysql> prompt

SET GLOBAL local_infile=1;
quit;
@ebta
ebta / init_user.md
Last active October 20, 2021 09:37
Initial Server Setup with Ubuntu 20.04

Login as Root user and do the following step :

  1. Creating a New User
adduser sammy
  1. Granting Administrative Privileges
usermod -aG sudo sammy
@ebta
ebta / mysqldump and mysqlpump backup.md
Last active April 3, 2023 03:13
Backup MySQL database using mysqldump & mysqlpump

Backup Using mysqldump

Mysqldump is a command-line utility that is used to generate the logical backup of the MySQL database. It produces the SQL Statements that can be used to recreate the database objects and data. The command can also be used to generate the output in the XML, delimited text, or CSV format.

Note: By default, mysqldump command does not dump the information_schema database, performance_schema, and MySQL Cluster ndbinfo database. If you want to include the information_schema tables, you must explicitly specify the name of the database in the mysqldump command, also include the —skip-lock-tables option.

mysqldump -uroot -p  --all-databases > all-databases.sql
mysqldump -uroot -p dbname > dbname.sql
mysqldump -uroot -p dbname table1 table2 > dbname_table_1_2.sql