Posts

Crontab command

 crontab -l  to see all listed crontab tasks. crontab -e to add/edit crontab tasks. Inside the crontab editor, the command would be composed of  <scheduler> <run command> <the output> * * * * * /home/ae/code.sh >> output.txt 2>&1  Which.. the 1st star = minutes to start running the 2nd star = hours to start running the 3rd star = day of the month to start running the 4th star = month to start running the 5th star = day of the week to start running More info: https://www.geeksforgeeks.org/crontab-in-linux-with-examples/  

2>&1 in command means??

References.. 0 =  standard input  ( stdin ) 1 =  standard output  ( stdout )  2 =  standard error  ( stderr ) Hence, we can use command > output.log to print the std output stream, which is an implicit meaning of command 1>output.log Thus, the annex 2>&1 means print the std error to the same place as the std output.  Moreover, the we can hide the std output from printing out by using 2>/dev/null. Thanks to: https://linuxize.com/post/bash-redirect-stderr-stdout/ Learning bash: https://iridakos.com/programming/2018/03/01/bash-programmable-completion-tutorial

MySQL Function: Thai months to String

 /*--------- Function: get_month ---------*/ DROP FUNCTION IF EXISTS get_month; DELIMITER $$ CREATE FUNCTION get_month(   m VARCHAR(100) ) RETURNS int(2)     DETERMINISTIC BEGIN  DECLARE me int(2) default 0;      IF m= 'ม.ค.' THEN set me= 1;     ELSEIF m= 'ก.พ.' THEN set me= 2;     ELSEIF m= 'มี.ค.' THEN set me= 3;     ELSEIF m= 'เม.ย.' THEN set me= 4;     ELSEIF m= 'พ.ค.' THEN set me= 5;     ELSEIF m= 'มิ.ย.' THEN set me= 6;     ELSEIF m= 'ก.ค.' THEN set me= 7;     ELSEIF m= 'ส.ค.' THEN set me= 8;     ELSEIF m= 'ก.ย.' THEN set me= 9;     ELSEIF m= 'ต.ค.' THEN set me= 10; ELSEIF m= 'พ.ย.' THEN set me= 11;     ELSEIF m= 'ธ.ค.' THEN set me= 12;     END IF;         RETURN me; END $$ DELIMITER ;

Prevent root-login on CentOS

1. Go to folder SSH > cd /etc/ssh 2. Edit file SSH configuration > vi sshd_config 3. Search word PermitRootLogin > /PermitRootLogin 3. Remove # and disable  PermitRootLogin > PermitRootLogin no 4. Restart SSH service > service sshd restart DONE!!😉

Recommended video screen recorder (on Window, Linux, Andriod)

On window use the program Free Cam On Linux use the program Peek sudo add-apt-repository ppa:peek-developers/stable sudo apt update sudo apt install peek or use the program VokoScreenNG sudo add-apt-repository ppa:ubuntuhandbook1/apps sudo apt update sudo apt install vokoscreen-ng On Andriod use the app XRecorder More detail for Linux: https://itsfoss.com/take-screenshot-linux/  

How different between words "Cutting-edges" and "State-of-the-art" ?

When I'm going through many of literature reviews from papers, articles, books, etc. these words confused me a bit, and here is the definition I've got. State-of-the-art : used for reference to the most modern and mature development technologies. Cutting-edges: used for reference to the best solutions but still in developing. Hope this could help you, see ya :)

Ruby on Rails with PosgreSQL : Basic tutorial

Installation Steps - Install Ubuntu and upgrade - Install Apache2 - Install Rails - Install Ruby - Install Passenger More Info:  https://nathanhoad.net/how-to-ruby-on-rails-ubuntu-apache-with-passenger Command Guides * To install Apache 2 development headers: sudo apt-get install apache2-dev * To install Ruby development headers: sudo apt-get install ruby-dev * To in stall Passenger gem install passenger passenger-install-apache2-module * To install Apache Portable Runtime (APR) development headers: sudo apt-get install libapr1-dev * To install Apache Portable Runtime Utility (APU) development headers: sudo apt-get install libaprutil1-dev * To install Curl development headers with SSL support: sudo apt-get install libcurl4-openssl-dev (or libcurl4-gnutls-dev) ------------ Set c onfig passenger ----------- LoadModule passenger_module /home/web05/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/passenger-5.3.4/buildout/apache2/mod_passenger.so