Skip to content

Instantly share code, notes, and snippets.

View aaron-baby's full-sized avatar
🍼
Make a bubble

Aaron Wang aaron-baby

🍼
Make a bubble
View GitHub Profile
@aaron-baby
aaron-baby / latency.txt
Created July 9, 2020 05:19 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
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
@aaron-baby
aaron-baby / demo.php
Last active October 25, 2018 03:22
demo
use GuzzleHttp\Client;
$dataPayload = $this->requestHelper->buildFrom()
// construct a new client
$client = new Client([
// Base URI is used with relative requests
'base_uri' => 'http://api.splio.cn',
// You can set any number of default request options.
'timeout' => 2.0,
@aaron-baby
aaron-baby / loop print date
Created June 2, 2015 03:46
loop print date from a start time
DATE=2015-05-20;for ((a=1;a<=10;a++)) ;do NEXT_DATE=$(date +%Y-%m-%d -d "$DATE + $a day");echo $NEXT_DATE; done;
  • 2009 Macbook Pro
  • 2.26 GHz Core 2 Duo
  • 4GB DDR3 (1067 MHz)
  • Redis v2.2.4
  • Node.JS v0.4.7

Summary of results

  • ab -n 10000 -c 10 = 1949 r/s
  • ab -n 10000 -c 20 = 1908 r/s
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
# wget -O install_python.sh https://gist.github.com/raw/777001/install_python.sh
# chmod +x install_python.sh
# ./install_python.sh
#!/bin/sh
echo "******************************************"
echo "Configure Centos box with a recent version"
echo "of Python. "
echo " - jgumbley 12/jan/11"
@aaron-baby
aaron-baby / gist:4970412
Created February 17, 2013 06:12
display error message
ini_set('display_errors', 1);
error_reporting(E_ALL);
@aaron-baby
aaron-baby / gist:3402763
Created August 20, 2012 09:57 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt