Skip to content

Instantly share code, notes, and snippets.

View aharen's full-sized avatar
👨‍💻
...

Ahmed Khusaam aharen

👨‍💻
...
View GitHub Profile
@aharen
aharen / cmd.sh
Created October 23, 2023 07:09 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@aharen
aharen / wireguard.conf
Created June 16, 2023 11:24 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
@aharen
aharen / sources.list
Created June 14, 2023 14:22 — forked from ishad0w/sources.list
Debian 10 (Buster) -- Full sources.list
deb http://deb.debian.org/debian buster main contrib non-free
deb-src http://deb.debian.org/debian buster main contrib non-free
deb http://deb.debian.org/debian buster-updates main contrib non-free
deb-src http://deb.debian.org/debian buster-updates main contrib non-free
deb http://deb.debian.org/debian buster-backports main contrib non-free
deb-src http://deb.debian.org/debian buster-backports main contrib non-free
deb http://security.debian.org/debian-security/ buster/updates main contrib non-free
@aharen
aharen / octane-on-forge.md
Created January 11, 2023 07:12 — forked from viezel/octane-on-forge.md
Quickly get Octane running on Laravel Forge

Quickly get Octane running on Laravel Forge

  1. Spin up a new App server, choose PHP 8
  2. SSH into it and run sudo -i to become root
  3. Run pecl install swoole and enable what you need. (I disabled curl as it did not work for me)
  4. Add a new Site to your server and use git to pull in your Laravel project that has Octane installed.
  5. Point your DNS to your new site
  6. Enable SSL using Lets Encrypt
  7. Change your new Sites Nginx settings to (assuing your site is named octane.example.com):
@aharen
aharen / app.html
Created June 21, 2022 13:35 — forked from potato4d/app.html
Nuxt.js use enviroment variables in app.html file
<!DOCTYPE html>
<html {{ HTML_ATTRS }}>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ ENV.GA_ID }}"></script>
<script>
console.log(`GA_ID: {{ ENV.GA_ID }}`)
</script>
<head>
{{ HEAD }}
</head>
<body {{ BODY_ATTRS }}>
@aharen
aharen / YoutubeThumbs.php
Created August 20, 2021 21:33 — forked from maximishchenko/YoutubeThumbs.php
Download Youtube Thumbnail
<?php
/**
* Get Preview Image from Youtube video link (not from embeded code) and download it if video exist
* @author Maxim Ishchenko <[email protected]>
* @version 1.0*
* @uses
*
* $getThumbs = new YoutubeThumbs('https://youtu.be/xxxxxxxxxxx', 'quality', 'directory');
* echo '<img src="'.$getThumbs->getThumbnail().'"/>';
@aharen
aharen / php-pools.md
Created December 30, 2020 21:25 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@aharen
aharen / swphp.sh
Last active November 30, 2020 19:27
Switch PHP Version
function swphp() {
versions=("7.4" "8.0")
for i in "${versions[@]}"; do
if [[ "$i" = $1 ]]; then
brew unlink php && brew link --overwrite --force php@$1
echo "PHP changed to "$1
return
fi
done
@aharen
aharen / !NOTE.md
Created June 30, 2020 23:37 — forked from mehranhadidi/!NOTE.md
Setup a Laravel Storage driver with Google Drive API