Skip to content

Instantly share code, notes, and snippets.

View mostafizpantheon's full-sized avatar

Mostafizur Rahman mostafizpantheon

View GitHub Profile
@mostafizpantheon
mostafizpantheon / settings.php
Created April 20, 2019 11:33 — forked from csemrm/settings.php
From bare domain to www for D8
<?php
########
if (isset($_ENV['PANTHEON_ENVIRONMENT']) && php_sapi_name() != 'cli') {
// Redirect to https://$primary_domain in the Live environment
if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live' && ($_SERVER['HTTP_HOST'] !== 'live-psea.pantheonsite.io')) {
if ($is_www = strpos($_SERVER['HTTP_HOST'], 'www')) {
$primary_domain = $_SERVER['HTTP_HOST'];
} else
@mostafizpantheon
mostafizpantheon / redirect.php
Last active May 2, 2019 16:17
redirect.php
<?php
if (isset($_ENV['PANTHEON_ENVIRONMENT']) && ($_SERVER['HTTP_HOST'] == 'insource.wedc.org') && (php_sapi_name() != "cli")) {
$newurl = 'https://wedc.org/newsletters/archive/' . $_SERVER['REQUEST_URI'];
header('HTTP/1.0 301 Moved Permanently');
header("Location: $newurl");
# Name transaction "redirect" in New Relic for improved reporting (optional)
if (extension_loaded('newrelic')) {
newrelic_name_transaction("redirect");
@mostafizpantheon
mostafizpantheon / MySQL_macOS_Sierra.md
Created September 22, 2019 00:52 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@mostafizpantheon
mostafizpantheon / self-signed-ssl-mongo.sh
Created October 25, 2021 15:20 — forked from exAspArk/self-signed-ssl-mongo.sh
Self-signed SSL Certificate with OpenSSL on MacOS | MongoDB
openssl genrsa -out CAroot.key 2048
openssl req -new -key CAroot.key -out CAroot.csr # CN should be different from the certificates below
openssl req -x509 -days 1825 -key CAroot.key -in CAroot.csr -out CAroot.crt
cat CAroot.crt CAroot.key > CAroot.pem
openssl genrsa -out mongod.key 2048
openssl req -new -key mongod.key -out mongod.csr
openssl x509 -req -days 1825 -in mongod.csr -CA CAroot.pem -CAkey CAroot.key -CAcreateserial -out mongod.crt
cat mongod.crt mongod.key > mongod.pem