Skip to content

Instantly share code, notes, and snippets.

View rmdhfz's full-sized avatar
:octocat:
Focusing

Hafiz Ramadhan rmdhfz

:octocat:
Focusing
View GitHub Profile
@rmdhfz
rmdhfz / nginx-tuning.md
Created November 12, 2020 08:12 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@rmdhfz
rmdhfz / active.md
Created March 12, 2021 15:14 — forked from paulmillr/active.md
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Tue, 06 Dec 2016 17:06:46 GMT till Wed, 06 Dec 2017 17:06:46 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 50)
@rmdhfz
rmdhfz / app.js
Created January 10, 2022 07:24
Technical Test - Pre Assessment Software Engineer (Jr. Back End) Ultra Voucher
const words = ["cook", "save", "taste", "aves", "vase", "state", "map"];
const findAnagrams = (words) => {
const uniqueAnagrams = [words[0]],
combinedAnagrams = [words[0]];
for (let i = 1; i < words.length; i++) {
const word = words[i];
let matched = false;
@rmdhfz
rmdhfz / whitelist.php
Last active April 14, 2022 02:51
Whitelist Incoming IP (midtrans) for Post Notification Payment
<?php
$RequestIP = (isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$IP_MIDTRANS = ['103\.208\..*', '103\.208\..*', '103\.127\..*', '103\.127\..*'];
if(!preg_match('/^(' . implode('|', $IP_MIDTRANS) . ')/', $RequestIP)){
http_response_code(401);
return false;
}
?>
<?php
$UA = $_SERVER["HTTP_USER_AGENT"];
private function ProtectWebCopier(){
global $UA;
$state = false;
if (preg_match("/webzip|httrack|wget|FlickBot|downloader|production
bot|superbot|PersonaPilot|NPBot|WebCopier|vayala|imagefetch|
Microsoft URL Control|mac finder|
emailreaper|emailsiphon|emailwolf|emailmagnet|emailsweeper|
Indy Library|FrontPage|cherry picker|WebCopier|netzip|