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
azhar25git / System Design.md
Created October 1, 2020 18:39 — forked from vasanthk/System Design.md
System Design Cheatsheet

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
azhar25git / README.md
Last active February 13, 2024 12:21 — forked from oodavid/README.md
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
azhar25git / next_nginx.md
Created August 16, 2020 06:48 — forked from kocisov/next_nginx.md
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
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.
<?php
/**
* @param string $domain Pass $_SERVER['SERVER_NAME'] here
* @param bool $debug
*
* @debug bool $debug
* @return string
*/
function get_domain($domain, $debug = false)
{
@azhar25git
azhar25git / Upload to Google Drive via PHP
Last active August 1, 2023 08:30
Upload to your Google Drive via PHP Script
<?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 https://console.cloud.google.com
$clientId = 'xxxxxxapps.googleusercontent.com';
$clientSec = 'xxxxxxxx';
// Get access tokens from https://developers.google.com/oauthplayground using your Own Client ID and Cilent Secret
@azhar25git
azhar25git / PHP CURL POST REQUEST WITH FILE
Last active August 1, 2023 08:30
Send file with POST request via CURL PHP 7
<?php
// You have to enable PHP CURL extension
//Initialise the cURL var
$ch = curl_init();
// Path of the file
$file_uri = realpath('cat.zip');
// Creates a CURLFile object, used to upload a file with CURLOPT_POSTFIELDS.
<?php
class CustomerAddress extends Model {
protected function setKeysForSaveQuery(Builder $query)
{
$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: https://github.com/mheiniger/webdev-setup

@azhar25git
azhar25git / User.php
Created February 28, 2018 12:25 — forked from bramnauta/User.php
app/User.php
<?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;