Skip to content

Instantly share code, notes, and snippets.

View 1Caxz's full-sized avatar
💯
Inspired

Saiful I. Wicaksana 1Caxz

💯
Inspired
View GitHub Profile
@1Caxz
1Caxz / bitwise-example-java
Last active December 22, 2022 08:32
Bitwise operator explanation and example
```java
public class Main {
public static void main(String[] args) {
// Bitwise OR (1 | 0 = 1)
System.out.print("OR: " + Integer.toString(12, 2)); // 00001100
System.out.print(" " + Integer.toString(25, 2)); // | 00011001
System.out.print(" " + Integer.parseInt("00011101", 2)); // = 00011101
System.out.println(" " + (12 | 25));
@1Caxz
1Caxz / nginx-tuning.md
Created November 18, 2022 06:46 — 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.

@1Caxz
1Caxz / opcache.ini
Created November 18, 2022 03:40 — forked from rohankhudedev/opcache.ini
Best Zend OpCache Settings / Tuning / Configurations
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=512
@1Caxz
1Caxz / php-fpm-high-cpu-usage-fix
Last active November 17, 2022 09:11
Config PHP-FPM for high 100% CPU
# www.conf https://thisinterestsme.com/php-fpm-settings/
pm = static # Good for high traffics
pm.max_children = 25
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 1000
# 2 things got me great improvement (<100ms TTFB):
## Enable http2 in all of my SSL server blocks (needs nginx 1.9.5+)
server {
listen 443 ssl http2;
#rest of your config here
}
## Set up fastcgi_cache
@1Caxz
1Caxz / Server Tweak
Last active February 10, 2021 04:48
PHP-FPM: Socket vs TCP/IP and sysctl tweaking
https://rtcamp.com/tutorials/php/fpm-sysctl-tweaking/
https://rtcamp.com/tutorials/linux/sysctl-conf/
# Reduce TTFB Asset Server Without Cloudflare
https://www.digitalocean.com/community/questions/how-can-i-improve-the-ttfb
# Enable IPTables for Cloudflare
https://hooshmand.net/how-to-use-cloudflare/
@1Caxz
1Caxz / npm-install-from-git.txt
Created May 15, 2020 10:48
npm install from public or private repos on GitHub or Bitbucket
# Get the latest from GitHub, public repo:
$ npm install username/my-new-project --save-dev
# GitHub, private repo:
$ npm install git+https://token:[email protected]/username/my-new-project.git#master
$ npm install git+ssh://[email protected]/username/my-new-project.git#master
# … or from Bitbucket, public repo:
$ npm install git+ssh://[email protected]/username/my-new-project.git#master --save-dev
# Bitbucket, private repo:
$ npm install git+https://username:[email protected]/username/my-new-project.git#master
@1Caxz
1Caxz / media-query.css
Created April 22, 2020 16:32 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@1Caxz
1Caxz / squid_proxy_tutorial.md
Created February 28, 2020 14:17 — forked from jackblk/squid_proxy_tutorial.md
Tutorial on how to setup a squid proxy with authentication.

Note

This tutorial is for Ubuntu & Squid3. Use AWS, Google cloud, Digital Ocean or any services with Ubuntu to follow this tutorial.

Install squid & update

sudo apt-get update
sudo apt-get install squid3
sudo apt-get install apache2-utils
@1Caxz
1Caxz / wiki-dead-link.txt
Last active April 26, 2022 03:23
Wikipedia Dead Link [SEO Backlink]