Skip to content

Instantly share code, notes, and snippets.

View ihfbib's full-sized avatar
🎯
Focusing

Hamada Habib ihfbib

🎯
Focusing
View GitHub Profile
@ihfbib
ihfbib / nginx.conf
Created July 25, 2023 09:18 — forked from hwdsl2/nginx.conf
Example nginx.conf for Ghost blog with Nginx and ModSecurity - https://blog.ls20.com/install-ghost-0-3-3-with-nginx-and-modsecurity/
user nginx;
worker_processes 2; # Set this equal to the number of CPU cores
events { worker_connections 1024; }
http {
server_names_hash_bucket_size 64;
types_hash_max_size 2048;
server_tokens off;
include mime.types;
default_type application/octet-stream;
sendfile on;
@ihfbib
ihfbib / readme.md
Created July 21, 2023 03:01 — forked from bagusnl/readme.md
Setting up Cloudflare R2 as CDN with HTTP frontend also uploads files from GitHub repository to said CDN with Actions

Setting up Cloudflare R2 as CDN

This guide will set up a CDN with URL frontend and sync them up from GitHub Repo with Actions

Things needed:

  • A domain that is tied to Cloudflare (free CF account is probably enough, depends on the load to your CDN)

Steps:

  1. Make a Cloudflare R2 bucket > Take a note of its bucket name.
@ihfbib
ihfbib / ProxyCFWorker.js
Created July 21, 2023 03:00 — forked from MiSaturo/ProxyCFWorker.js
A URL proxy based on Cloudflare workers
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request).catch((err) => { return new Response(err.message) }))
})
const html = `<!DOCTYPE html>
<html>
<head>
<title>CF direct chain transfer</title>
</head>
<body>
@ihfbib
ihfbib / gaWorker.js
Created July 21, 2023 02:58 — forked from xiaopc/gaWorker.js
Google Analytics 4 Proxy with Cloudflare Workers
// 2023.4.23 更新,修复 gtag.js 加了个回车导致失效的问题
// 2023.3.2 更新,修复上报到 region*.google-analytics.com 未被代理的问题
addEventListener('fetch', (event) => {
// 这里可以加 filter
return event.respondWith(handleRequest(event));
});
// worker 应用的路由地址,末尾不加 '/'
const DOMAIN = 'https://example.workers.dev/routerpath';
@ihfbib
ihfbib / cf-wp-cache-worker.js
Created July 21, 2023 02:15 — forked from brandomeniconi/cf-wp-cache-worker.js
Basic Cloudflare Worker that allows efficient page caching for Wordpress websites
// Version 1.4
const DAY_IN_SECONDS = 60*60*24;
const BLACKLISTED_URL_PARAMS = [
'fbclid', // Google Ads click Id
'gclid', // Facebook click Id
'msclkid', // Micorosft Ads Click Id
];
addEventListener('fetch', event => {
site:*/sign-in
site:*/account/login
site:*/forum/ucp.php?mode=login
inurl:memberlist.php?mode=viewprofile
intitle:"EdgeOS" intext:"Please login"
inurl:user_login.php
intitle:"Web Management Login"
site:*/users/login_form
site:*/access/unauthenticated
site:account.*.*/login
site:*/sign-in
site:*/account/login
site:*/forum/ucp.php?mode=login
inurl:memberlist.php?mode=viewprofile
intitle:"EdgeOS" intext:"Please login"
inurl:user_login.php
intitle:"Web Management Login"
site:*/users/login_form
site:*/access/unauthenticated
site:account.*.*/login
@ihfbib
ihfbib / City Model
Created February 21, 2023 05:06 — forked from phackwer/City Model
Laravel 5 - all cities, regions, states and countries from Gazeteer
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class City extends Model
{
/**
* @var array
@ihfbib
ihfbib / Response.php
Created February 15, 2023 20:36 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@ihfbib
ihfbib / wordpress.conf
Created January 18, 2023 07:45 — forked from ilokano/wordpress.conf
nginx settings for WordPress.
# https://codex.wordpress.org/Nginx
# Global restrictions configuration file.
# Deleted config for .htaccess, robots.txt, favicon restriction
# because they are already included in the default
# domain.conf created by ispconfig
# Block PHP files in uploads, content, and includes directory.
location ~* /(?:uploads|files|wp-content|wp-includes)/.*\.php$ {
deny all;
}