Skip to content

Instantly share code, notes, and snippets.

View mindscms's full-sized avatar

MindsCMS mindscms

View GitHub Profile
## Don't forget to change localhost to your local domain in (server_rootCA.csr.cnf & v3.ext)
## (( ONLY )) In localhost, you have need to change SSLCertificateFile & SSLCertificateKeyFile in vhosts-ssl.conf to new generated server.crt & server.key
## In other domains, you need to configure httpd-vhost.conf only.
# openssl genrsa -out server_rootCA.key 2048
# openssl req -x509 -new -nodes -key server_rootCA.key -sha256 -days 3650 -out server_rootCA.pem
# v3.ext
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
# server_rootCA.csr.cnf
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
[dn]
C=SA
ST=Makkah
function word_limiter($str, $limit = 100, $end_char = '…'){
$str2 = strip_tags($str);
//$str2 = $str;
if (trim($str2) == ''){
return $str2;
}
preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str2, $matches);
if (strlen($str2) == strlen($matches[0])){
$end_char = '';
}
@echo off
set /p domain="Enter Domain: "
set OPENSSL_CONF=../conf/openssl.cnf
REM
REM Read the "cert-template.conf" file and replace all {{DOMAIN}} placeholders by the entered domain.
REM Write the result into a new file called "cert.conf".
REM
REM @see https://stackoverflow.com/questions/5273937/how-to-replace-substrings-in-windows-batch-file#20227248
REM
[req]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[subject]
@mindscms
mindscms / MySlugHelper.php
Created August 15, 2020 14:49
Class for maintain Arabic language in cviebrock/eloquent-sluggable
/**
* Setup:
* 1- Create MySlugHelper.php inside app/Helper/MySlugHelper.php
* 2- Edit config/sluggable.php:
* replace line ('method' => null,) with ('method' => [App\Helper\MySlugHelper::class, 'slug'],)
*/
<?php