Skip to content

Instantly share code, notes, and snippets.

View akrez's full-sized avatar
😋
Work Partially

AliAkbar Rezaei akrez

😋
Work Partially
View GitHub Profile
cd /tmp
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt --fix-broken install
cd /opt/google/chrome
sudo chown -R www-data:www-data chrome
sudo chmod -R 775 chrome
$snappdf = new Snappdf;
$snappdf->setChromiumPath('/usr/bin/google-chrome');
@akrez
akrez / apt-remove.sh
Created February 24, 2025 09:31
This is a small script to get a minimal install of Linux Debian 21 by uninstalling some preinstalled packages. This won't remove any critical packages. Use at your own risk. To directly run the script:
sudo apt-get remove \
baobab \
ca-certificates-java \
cheese \
cheese-common \
default-jre \
default-jre-headless \
gnome-calculator \
gnome-calendar \
gnome-disk-utility \
@akrez
akrez / DB::listen
Last active November 13, 2024 14:50
log all queries
DB::listen(function (QueryExecuted $query) {
info("🔵\t".$query->toRawSql());
});
@akrez
akrez / ForgotPasswordController.php
Created August 12, 2024 12:29
Reset Password Request in LARAVEL 11 with Mobile ( or SMS or Phone or anything else except Email )
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Rules\IranMobileRule;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use Illuminate\Validation\ValidationException;
@akrez
akrez / App\Contracts\ResponseBuilderContract.php
Created July 16, 2024 13:48
Laravel Response Builder (Facade + Builder design pattern)
<?php
namespace App\Contracts;
use Illuminate\Contracts\Support\Responsable;
interface ResponseBuilderContract extends Responsable
{
public function status(int $status): self;
@akrez
akrez / install.sh
Created November 8, 2023 12:47
install composer in special dir and filename
#!/bin/bash
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
@akrez
akrez / hosts
Last active September 6, 2023 09:30
define virtual host in wamp as fastcgi and nonefastcgi
#
127.0.0.1 localhost
::1 localhost
127.0.0.255 lavash
::1 lavash
127.0.0.254 lavashnonecgi
::1 lavashnonecgi
#!/usr/bin/env bash
PACKAGES="$*"
ABSOLUTE_PATH=$(realpath $(dirname ${BASH_SOURCE[0]}))
function error {
echo "$1" 1>&2
exit 1
}
@akrez
akrez / Database.php
Last active June 1, 2023 11:07
simple sample database wrapper worked with pdo and sqlite
<?php
class Database
{
protected $pdo;
protected function setPdo(PDO $pdo)
{
return $this->pdo = $pdo;
}
protected function getPdo()
git archive --format=zip --output asd.zip 56a4e42e