Skip to content

Instantly share code, notes, and snippets.

View jebrial's full-sized avatar
📡
searching for life

Gabe Dalay jebrial

📡
searching for life
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jebrial on github.
  • I am jebrial (https://keybase.io/jebrial) on keybase.
  • I have a public key whose fingerprint is F95B 273A 4CD7 C194 4E0D 46EC 3D15 00B3 FA10 6B6C

To claim this, I am signing this object:

@jebrial
jebrial / latency.txt
Created September 13, 2017 19:38 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
const numMap = {
'1': [],
'2': ['a', 'b', 'c'],
'3': ['d', 'e', 'f'],
'4': ['g', 'h', 'i'],
'6': ['m', 'n', 'o'],
'7': ['p','q','r','s']
};
function possibleStrings(numPadStr) {
function getMaxProfit(stockPricesYesterday) {
let buy = stockPricesYesterday[0], sell = stockPricesYesterday[1];
for(let i = 1; i < stockPricesYesterday.length - 1; i++) {
if(stockPricesYesterday[i] < buy) {
buy = stockPricesYesterday[i];
}
if(stockPricesYesterday[i+1] > sell) {
sell = stockPricesYesterday[i+1]
# Test data for study
# Generated with: https://www.generatedata.com/
CREATE TABLE `students` (
`id` mediumint,
`name` varchar(255) default NULL,
PRIMARY KEY (`id`)
);
INSERT INTO `students` (`id`,`name`) VALUES (1,"Xerxes"),(2,"Scott"),(3,"Marvin"),(4,"Justin"),(5,"Idola"),(6,"Jaquelyn"),(7,"Doris"),(8,"Buffy"),(9,"Hyatt"),(10,"Gloria");
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q) -f
# Delete all images
docker rmi $(docker images -q) -f
// This is a simple boilerplate to use for testing function in the node/javascriptures env
// Main function definition:
function mainFunc() {
}
// Helpers:
export COLOR_NC='\e[0m' # No Color
export COLOR_WHITE='\e[1;37m'
export COLOR_BLACK='\e[0;30m'
export COLOR_BLUE='\e[0;34m'
export COLOR_LIGHT_BLUE='\e[1;34m'
export COLOR_GREEN='\e[0;32m'
export COLOR_LIGHT_GREEN='\e[1;32m'
export COLOR_CYAN='\e[0;36m'
export COLOR_LIGHT_CYAN='\e[1;36m'
export COLOR_RED='\e[0;31m'
@jebrial
jebrial / flask_wrk_osx.py
Last active November 28, 2017 22:15
Flask simple benchmark
"""
Running Flask local on osx high Sierra:
wrk -t12 -c400 -d30s http://127.0.0.1:5000Running 30s test @ http://127.0.0.1:5000
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 180.97ms 54.38ms 703.26ms 90.93%
Req/Sec 56.94 30.42 272.00 75.13%
16484 requests in 30.10s, 2.69MB read
Socket errors: connect 0, read 1520, write 25, timeout 0
@jebrial
jebrial / sanic_wrk_osx.py
Last active November 28, 2017 22:16
Sanic simple benchmark
"""
Running Sanic local on osx high Sierra:
wrk -t12 -c400 -d30s http://0.0.0.0:5000
Running 30s test @ http://0.0.0.0:5000
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 128.82ms 42.87ms 260.89ms 59.30%
Req/Sec 246.53 93.91 686.00 71.81%
87926 requests in 30.10s, 10.73MB read