Skip to content

Instantly share code, notes, and snippets.

View azhar25git's full-sized avatar
Coding is life

Azhar Uddin azhar25git

Coding is life
View GitHub Profile
azhar25git / System
Created October 1, 2020 18:39 — forked from vasanthk/System
System Design Cheatsheet
View System

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
azhar25git /
Last active June 7, 2023 16:18 — forked from oodavid/
Deploy your site with git (UPDATED: August 2020)

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
azhar25git /
Created August 16, 2020 06:48 — forked from kocisov/
How to setup next.js app on nginx with letsencrypt

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

azhar25git / get domain without subdomain.php
Created December 25, 2019 11:34 — forked from pocesar/get domain without subdomain.php
PHP code to get the domain name without subdomains (includes the tld, and the special types from IANA). Don't have support for unicode domain names.
View get domain without subdomain.php
* @param string $domain Pass $_SERVER['SERVER_NAME'] here
* @param bool $debug
* @debug bool $debug
* @return string
function get_domain($domain, $debug = false)
azhar25git / Upload to Google Drive via PHP
Last active August 1, 2023 08:30
Upload to your Google Drive via PHP Script
View Upload to Google Drive via PHP
// error_reporting( E_ALL );
// you need to get Google OAuth Client Package with this command: composer require google/apiclient:"^2.0"
require __DIR__ . '/vendor/autoload.php';
// Credentials for your Drive App created on
$clientId = '';
$clientSec = 'xxxxxxxx';
// Get access tokens from using your Own Client ID and Cilent Secret
Last active August 1, 2023 08:30
Send file with POST request via CURL PHP 7
// You have to enable PHP CURL extension
//Initialise the cURL var
$ch = curl_init();
// Path of the file
$file_uri = realpath('');
// Creates a CURLFile object, used to upload a file with CURLOPT_POSTFIELDS.
View CustomerAddress.php
class CustomerAddress extends Model {
protected function setKeysForSaveQuery(Builder $query)
->where('Customer_No', '=', $this->getAttribute('Customer_No'))
->where('Address_Name', '=', $this->getAttribute('Address_Name'));

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here:

azhar25git / User.php
Created February 28, 2018 12:25 — forked from bramnauta/User.php
View User.php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;