Nginx test config and reload

Updated: 24th November 2020
Tags: nginx

Fast command to test nginx config and reload nginx if test is successful

sudo nginx -t && sudo nginx -s reload

Ubuntu run command in background

Updated: 14th November 2020
Tags: terminal comman linux ubuntu

To run some command in background, so you can close terminal, type the following:

nohup command-with-options &

Build golang app from windows to Linux 64 bit

Updated: 14th November 2020
Tags: go windows linux build

TL DR; To build app on windows to linux 64 type this in powershell

$Env:GOOS = "linux"; $Env:GOARCH = "amd64"; go build main.go

Windows powershell get first / last 100 lines of txt file

Updated: 1th July 2020
Tags: windows powershell

PHP server cmd command

Updated: 6th February 2020
Tags: php

PHP server in current directory

php -S localhost:8000

PHP server in public directory

php -S localhost:8000 -t public

MySQL Fix login for phpmyadmin

Updated: 24th December 2019
Tags: sql mysql

[Solved] MySQL ERROR 1231 (42000):Variable 'character_set_client' can't be set to the value of 'NULL'

Updated: 24th December 2019
Tags: sql mysql

If you try to import dumped file, and there is such an error, try using mysql console with options and then import sql file

mysql -u root -p --max_allowed_packet=6400M

Troubleshoot

If you haven’t acess to console or the previous doesn’t work

set global max_allowed_packet=10000000000;

PHP Simple PDO class

Updated: 23th December 2019
Tags: php mysql sql

SQL select latest row from table

Updated: 22th December 2019
Tags: sql
SELECT * FROM my_table ORDER BY id DESC LIMIT 1;

SQL select max id from table

Updated: 22th December 2019
Tags: sql
SELECT MAX(id) FROM my_table;

Laravel select random row from table

Updated: 22th December 2019
Tags: php laravel sql

Get randow row from table in laravel 5.3+

$randomRow = DB::table('table')
            ->inRandomOrder()
            ->first();

Get randow id from table in laravel 5.3+

$randomId = DB::table('table')
            ->inRandomOrder()
            ->value('id');

How to be friend with mysql timestamp

Updated: 22th December 2019
Tags: sql mysql

SQL select random row from table

Updated: 22th December 2019
Tags: sql
SELECT * FROM my_table ORDER BY RAND() LIMIT 1;

Hugo remove categories page

Updated: 21th December 2019
Tags: hugo

Increase laravel performance

Updated: 20th December 2019
Tags: php laravel

Update laravel/installer global

Updated: 20th December 2019
Tags: php composer laravel

Laravel fresh install ubuntu HTTP 500 Fix

Updated: 18th December 2019
Tags: php laravel ubuntu

After installing laravel you MUST change some folder permissions.

sudo chmod 755 -R laravel_app
sudo chmod -R o+w laravel_app/storage
sudo chmod -R o+w laravel_app/bootstrap/cache

Redis Commands

Updated: 6th December 2019
Tags: redis

How to Install Redis on Ubuntu 18.04

Updated: 5th December 2019
Tags: redis ubuntu

Install PHP 7.4 on Apache Ubuntu 18.04

Updated: 4th December 2019
Tags: php apache