Skip to content

Instantly share code, notes, and snippets.

View nadyshalaby's full-sized avatar
🏠
Working from home

Nady Shalaby nadyshalaby

🏠
Working from home
View GitHub Profile
@nadyshalaby
nadyshalaby / Laravel Security.md
Last active February 19, 2025 07:36
The process of securing your Laravel application.
npm install -g uglify-js clean-css-cli
@nadyshalaby
nadyshalaby / hls.sh
Created November 8, 2024 22:42 — forked from stenuto/hls.sh
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
@nadyshalaby
nadyshalaby / .deps...npm...hardhat...console.sol
Created August 2, 2023 01:35
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
library console {
address constant CONSOLE_ADDRESS =
0x000000000000000000636F6e736F6c652e6c6f67;
function _sendLogPayloadImplementation(bytes memory payload) internal view {
address consoleAddress = CONSOLE_ADDRESS;
/// @solidity memory-safe-assembly
@nadyshalaby
nadyshalaby / bitbucket-pipelines.yml
Last active June 26, 2023 08:02
How to deploy a NestJs Application on GCP Compute Engine
image: atlassian/default-image:3
pipelines:
branches:
develop:
- step:
name: Deploy to GCP
caches:
- docker
script:
@nadyshalaby
nadyshalaby / Dockerfile
Last active June 26, 2023 08:27
How to deploy a NestJs Application on Cloud Run Service using CloudBuild and Docker
FROM node:lts-alpine3.18
WORKDIR /app
COPY package.json .
RUN yarn
COPY . .
RUN yarn build
EXPOSE 3000
CMD [ "yarn", "start:prod" ]
@nadyshalaby
nadyshalaby / JsTranslationsServiceProvider.php
Created April 9, 2023 02:00
Laravel blade directive to load laravel lang files using helper like the translation helper that laravel uses `__(key, [])`
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class JsTranslationsServiceProvider extends ServiceProvider
{
public function register(): void
@nadyshalaby
nadyshalaby / 0- install nodejs and redis.sh
Created December 27, 2022 23:27 — forked from moaalaa/0- install nodejs and redis.sh
How to run PM2 with laravel queue and laravel echo server
# Node Js
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
sudo yum install nodejs
node --version
npm --version
# Redis
@nadyshalaby
nadyshalaby / decode.ts
Created September 9, 2022 09:36 — forked from chjlsch/decode.ts
recursively encode and decode querystrings (encode = object to querystring, decode = querystring to object)
export function decode(querystring: string): object {
function parseValue(value: string): any {
if (value === 'TRUE') return true;
if (value === 'FALSE') return false;
return isNaN(Number(value)) ? value : Number(value);
}
function dec(list: any[], isArray = false): object {
let obj: any = isArray ? [] : {};
@nadyshalaby
nadyshalaby / Laravel Vite SSL on Localhost
Created September 5, 2022 09:04
Enable SSL on Laravel Vite Project
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
server: {
https: {
key: "/opt/homebrew/etc/httpd/certs/syanat-app.test-key.pem",
cert: "/opt/homebrew/etc/httpd/certs/syanat-app.test.pem",
},
host: 'syanat-app.test',