Skip to content

Instantly share code, notes, and snippets.

View h-azad's full-sized avatar
🎯
Focusing

Hossain Azad h-azad

🎯
Focusing
  • Dhaka,Bangladesh
View GitHub Profile
<?php
namespace App\Http\Controllers\API;
use App\Enums\MenuItemRewardEnum;
use App\Enums\OrderCheckStatusEnum;
use App\Enums\OrderItemSelectionTypeEnum;
use App\Enums\OrderPaymentStatusEnum;
use App\Http\Requests\API\UpdateOrderServiceChargesRequest;
use App\Http\Requests\API\VoidOrderPaymentRequest;
#!/bin/bash
# Script to install Docker on a Debian-based Linux distribution
# Remove any conflicting packages
echo "Removing conflicting packages..."
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do
sudo apt-get remove -y $pkg
done
@h-azad
h-azad / gist:52ff9609c4078938006dadc5acd81500
Created August 11, 2023 09:13
Search Query Update JS
const [filterQuery, setFilterQuery] = useState({})
function updateFilterQUery(term, value) {
let filters = { ...filterQuery }
if (term != 'page') {
filters['page'] = 1
}
if (value) {
filters[term] = value
} else {
@h-azad
h-azad / Install Node.js on Ubuntu
Created October 8, 2022 11:52
Installing Node.js with Apt Using a NodeSource PPA
cd ~
curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh
sudo bash /tmp/nodesource_setup.sh
sudo apt install nodejs
node -v
Output
sudo apt update && sudo apt upgrade -y
sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
@h-azad
h-azad / Laravel Queue using PM2
Created October 8, 2022 11:02
Run and monitor Laravel Queue using PM2
pm2 start artisan --name laravel-worker --interpreter php -- queue:work --tries=3 --daemon
function uniqueBy(arr, fn) {
var unique = {};
var distinct = [];
arr.forEach(function (x) {
var key = fn(x);
if (!unique[key]) {
distinct.push(key);
unique[key] = true;
}
});
sudo chmod -R gu+w storage bootstrap/cache
sudo chmod -R guo+w storage bootstrap/cache
@h-azad
h-azad / RedisPID
Created September 23, 2021 06:44
Redis Daemon not creating a PID file
If: # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
Do:
In my case error was: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory after starting redis server. Each time restarting the redis server I was facing similar issue.
Editing nano /etc/systemd/system/redis.service and adding this line below [Service]:
ExecStartPost=/bin/sh -c "echo $MAINPID > /var/run/redis/redis.pid"
It suppose to look like this:
@h-azad
h-azad / decimalToFraction.html
Last active February 20, 2020 09:52
Convert a Decimal number to Fractional string
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Decimal to Fraction String</title>
</head>
<body>
<div>
<input type='number' id='decimalInput' /> <button type='button' onClick="toFraction()">Convert</button>