Skip to content

Instantly share code, notes, and snippets.

View daubac402's full-sized avatar
πŸ‡»πŸ‡³
πŸŽ„

NguyenTheAnh daubac402

πŸ‡»πŸ‡³
πŸŽ„
View GitHub Profile
@daubac402
daubac402 / Prepare files for sumitting to SSL CA (https)
Created April 10, 2019 05:21
Prepare files for sumitting to SSL CA (https)
1) Create 2048bit key
openssl genrsa -out file_name.key 2048
2) Create CSR
openssl req -new -key file_name.key -out file_name.csr
@daubac402
daubac402 / MySQL - Setup remotely connect
Created April 10, 2019 05:23
MySQL - Setup remotely connect
CREATE USER 'new_user'@'%' IDENTIFIED BY 'new_password';
GRANT ALL PRIVILEGES ON your_database.* TO new_user@'%' IDENTIFIED BY 'new_password';
@daubac402
daubac402 / Avoid IE Compatibility Mode
Created April 10, 2019 05:24
Avoid IE Compatibility Mode
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
@daubac402
daubac402 / Apachectl - check config and restart
Created April 10, 2019 05:25
Apachectl - check config and restart
1) Config check
apachectl -t
2) Restart apache
apachectl graceful
OR
apachectl -k graceful
@daubac402
daubac402 / Can not Add user to vsftpd? Have a look at pam_service
Last active April 13, 2020 04:44
Can not Add user to vsftpd? Have a look at pam_service
1) Check in /etc/vsftpd/vsftpd.conf
pam_service_name=???
2) Check pam config in /etc/pam.d/???
Eg:
auth required /usr/lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account required /usr/lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
3) Check user config to set home directory at /etc/vsftpd/vsftpd.conf
user_config_dir=/etc/vsftpd/vsftpd_user_conf/
@daubac402
daubac402 / .htaccess - Increase Performance on Apache server
Last active April 23, 2019 09:00
.htaccess - Increase Performance on Apache server
# TN START GZIP COMPRESSION
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
@daubac402
daubac402 / Laravel - Generate models from the database automatically
Created May 23, 2019 07:09
Laravel - Generate models from the database automatically
1. composer require reliese/laravel
2. Add the service provider to your config/app.php file
Reliese\Coders\CodersServiceProvider::class
3. Publish the config file with
php artisan vendor:publish --tag=reliese-models
4. Make sure your database is correctly configured in config/database.php and .env files.
@daubac402
daubac402 / Numpad_plus_TOGGLE_w_button.ahk
Last active October 17, 2023 08:49
Toggle Auto holding W key (accelerator key) for GTA Online (turn on/off by Numpad Add key) (require: AutoHotkey)
timer_cb:
{
SetKeyDelay, -1
if (toggle_flag) {
Send, {Blind}{w DownTemp}
} else {
SetTimer, timer_cb, OFF
Send, {Blind}{w UP}
}
}
@daubac402
daubac402 / Calculate_the_current_Apache_memory_usage_and_Average_proccess_size.sh
Last active July 24, 2022 11:29
Calculate the current Apache memory usage and Average proccess size
# You can change httpd to apache, apache2, ... that match with your env
ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'
@daubac402
daubac402 / copy_a_file_to_same_path_in_multi_siblings_directory_linux.sh
Last active July 19, 2019 07:23
Copy a file to same path in multi siblings directory linux
# You want to copy/replace a/sub_i/sub_j/x.html to b/.., c/.. etc.
# (your_current_dir)
# |___a
# | |____sub_i
# | |____sub_j
# | |____x.html
# |___b
# | |____sub_i
# | |____sub_j
# | |____x.html