Skip to content

Instantly share code, notes, and snippets.

View rizafr's full-sized avatar
🏠
Working from home

Riza rizafr

🏠
Working from home
  • Bobobox
  • Cimahi
  • 06:03 (UTC +07:00)
View GitHub Profile
@rizafr
rizafr / latency.markdown
Created December 18, 2021 13:33 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@rizafr
rizafr / Googlemaps.php
Created November 27, 2021 14:58 — forked from agisrh/Googlemaps.php
Google Maps Codeigniter library for PHP version 7 or higher file modified from https://github.com/BIOSTALL/CodeIgniter-Google-Maps-V3-API-Library
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter Google Maps API V3 Class
*
* Displays a Google Map
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
@rizafr
rizafr / list.md
Created November 3, 2021 02:52 — forked from jfroom/list.md
List of Front-end Job Interview Questions & Take Home Assignments / Tests / Homework
@rizafr
rizafr / coordinatestoname.js
Last active December 16, 2020 07:45 — forked from AmirHossein/coordinatestoname.js
Get City and Country name by coordinates via Google Maps api
// Demo: http://jsfiddle.net/xuyp8qb5/
// Note: You need Google Map API Key to run demo; bit.ly/2pBgToW
var latlng;
latlng = new google.maps.LatLng(40.730885, -73.997383); // New York, US
//latlng = new google.maps.LatLng(37.990849233935194, 23.738339349999933); // Athens, GR
//latlng = new google.maps.LatLng(48.8567, 2.3508); // Paris, FR
//latlng = new google.maps.LatLng(47.98247572667902, -102.49018710000001); // New Town, US
//latlng = new google.maps.LatLng(35.44448406385493, 50.99001635390618); // Parand, Tehran, IR
//latlng = new google.maps.LatLng(34.66431108560504, 50.89113940078118); // Saveh, Markazi, IR
@rizafr
rizafr / nginx.conf
Created March 24, 2020 05:12 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@rizafr
rizafr / slugify.js
Created January 28, 2019 04:21 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@rizafr
rizafr / nginx-tuning.md
Created October 11, 2018 06:27 — 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.

@rizafr
rizafr / gammu-configure-mysql.md
Created May 27, 2017 07:19 — forked from tomysmile/gammu-configure-mysql.md
Gammu: Configuring SMSD in OSX using MySQL Database

Configuring Gammu in OSX with MySQL

Requirements:

Step by step:

  • Check the sql files in here
@rizafr
rizafr / gammu-install-osx.md
Created May 17, 2017 13:56 — forked from tomysmile/gammu-install-osx.md
Gammu: Install on OSX 10.11 with Wavecom Modem M1306B

Configuring Gammu for Mac OSX 10.11

Requirements

Step by step:

  • Type below command :
@rizafr
rizafr / _.md
Created January 4, 2017 09:21
Arc Pie