Skip to content

Instantly share code, notes, and snippets.

@jazeabby
jazeabby / DockerFile
Created November 12, 2020 20:15
DockerFile for laravel application
FROM php:7.4-cli
# Update packages
RUN apt-get update
# Install PHP and composer dependencies
RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev libzip-dev
# Clear out the local repository of retrieved package files
RUN apt-get clean
@jazeabby
jazeabby / HomeController.php
Last active May 19, 2020 11:51
Initial Usage of Cache Model in a controller
<?php
namespace App/Controllers;
use App/models/CacheModel as Cache;
Class HomeController
{
private $cache;
public function __construct()
@jazeabby
jazeabby / CacheModel.php
Last active May 19, 2020 11:50
Initial model to for Memcache connection
<?php
namespace App/Models;
class CacheModel
{
private $instance = null;
public function __construct()
{
@jazeabby
jazeabby / memcached_test.php
Created May 16, 2020 19:23
Memcached Test script for PHP
<?php
error_reporting(E_ALL & ~E_NOTICE);
$mc = new Memcached();
$mc->addServer("localhost", 11211);
$mc->set("foo", "Hello!");
$mc->set("bar", "Memcached...");
$arr = array(
@jazeabby
jazeabby / grecaptcha_helper.php
Last active July 2, 2019 10:22
This helper can be used as a reference to implement Google Recaptcha v3 alognwith grecaptcha.js
<?php
/**
* @author Abhishek Jain
* @email jazeabby@gmail.com
* @create date 2019-07-02 12:08:44
* @modify date 2019-07-02 12:08:44
* @desc Helper to Implement Google Recaptcha V3
* Update:
0. Pleace your Google-server-secret and google-client-key before proceeding
Create these keys at: https://www.google.com/u/1/recaptcha/admin/create
#add these primary resources to include Facebook
<div id="fb-root"></div>
# button for facebook
<button class="" onclick="_login();" ><i class="fa fa-facebook-official fa-2x" aria-hidden="true"></i>
Continue with Facebook
</button>
# javascript/jquery
<script type="text/javascript">
#header file
<meta name="google-signin-client_id" content="{{your-google-client-id}}">
#google js package to include
<script src="https://apis.google.com/js/platform.js?onload=renderButton" async defer></script>
#html button div
<div id="my-signin2"></div>
#This is just a listing of the commands for generating your SSL certificates
#Run these commands one at a time from inside your ~/ssl folder
#Make sure you create your server.csr.cnf and your v3.ext files first inside the same folder
#private key generation
#This will ask you for a passphrase(password) do NOT lose this file or the password
openssl genrsa -des3 -out ~/ssl/rootCA.key 2048
#create root certificate
openssl req -x509 -new -nodes -key ~/ssl/rootCA.key -sha256 -days 1024 -out ~/ssl/rootCA.pem
[req]
default_bits= 2048
prompt= no
default_md= sha256
distinguished_name = dn
[dn]
C = Gurgaon
ST = HR
L = Gurgaon
O = End Point
authorityKeyIdentifier = keyid, issuer
basicConstraints = CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost