Skip to content

Instantly share code, notes, and snippets.

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

NguyenTheAnh daubac402

πŸ‡»πŸ‡³
πŸŽ„
View GitHub Profile
@daubac402
daubac402 / Add SSL to laradock apache2
Last active June 7, 2021 01:20
Add SSL to laradock apache2
0. Do this step 1 time only
vim /your_laradock_location/apache2/Dockerfile, add these line before the "COPY vhost.conf /etc/apache2/sites-enabled/vhost.conf" line and "ENTRYPOINT" line:
RUN mkdir /etc/apache2/ssl/
COPY ssl /etc/apache2/ssl/
----
1. Prepare your cert, key, ca files for your site at: /your_laradock_location/apache2/ssl/your_site/your_files
2. In your config file at host: /your_laradock_location/apache2/sites/your_site.conf, add to "<VirtualHost *:443>":
SSLCertificateFile /etc/apache2/ssl/your_site/your_crt.crt
### Keybase proof
I hereby claim:
* I am daubac402 on github.
* I am daubac402 (https://keybase.io/daubac402) on keybase.
* I have a public key ASAdoYrKDbbygnnrNlNnHEfLK68cqY6iKZn-ece6UosGBwo
To claim this, I am signing this object:
@daubac402
daubac402 / .htaccess - Require basic authen for specific path
Last active September 6, 2019 06:48
.htaccess - Require basic authen for specific path
# Condition
SetEnvIf Request_URI ^/your_secure_path auth=1
# Basic Authen
AuthName "Basic Auth"
AuthType Basic
AuthUserFile "/path/to/my/.htpasswd"
@daubac402
daubac402 / Rewrite your_url_index.php to your_url only
Created September 6, 2019 02:12
Some of URLs were crawled by Google with "index.php". Redirect "bad" URLs .../index.php to correct once .../, without index.php
# Some of URLs were crawled by Google with "index.php". Redirect "bad" URLs .../index.php to correct once .../, without index.php
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
@daubac402
daubac402 / install Postfix - Dovecot - Squirrelmail on CentOS 7
Created July 31, 2019 04:13
install Postfix - Dovecot - Squirrelmail on CentOS 7
Remove sendmail
# yum remove sendmail
------------------------------------
Install Postfix
# yum install postfix
------------------------------------
Configure Postfix
# vim /etc/postfix/main.cf
@daubac402
daubac402 / Convert .csr > .crt
Last active August 21, 2023 10:04
Convert .csr > .crt
openssl x509 -req -in your_file.csr -signkey your_file.key -out your_file.crt
@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
@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 / 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 / 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.