Note: "Forked" from Latency Numbers Every Programmer Should Know
| Event | Nanoseconds | Microseconds | Milliseconds | Comparison |
|---|---|---|---|---|
| L1 cache reference | 0.5 | - | - | - |
| Branch mispredict | 5.0 | - | - | - |
| L2 cache reference | 7.0 | - | - | 14x L1 cache |
| Mutex lock/unlock | 25.0 | - | - | - |
| #coding: utf-8 | |
| import json | |
| import requests | |
| class Slack(object): | |
| """ | |
| References: |
| ## Java | |
| sudo apt-get update | |
| sudo apt-get install default-jdk | |
| ## Scala | |
| sudo apt-get remove scala-library scala | |
| sudo wget http://scala-lang.org/files/archive/scala-2.12.1.deb | |
| sudo dpkg -i scala-2.12.1.deb | |
| sudo apt-get update | |
| sudo apt-get install scala |
| # Install Docker on Ubuntu 14.04.4 x64 | |
| # Ref https://docs.docker.com/engine/installation/linux/ubuntulinux/ | |
| # No interactive for now. | |
| export DEBIAN_FRONTEND=noninteractive | |
| # Update your APT package index. | |
| sudo apt-get -y update | |
| # Update package information, ensure that APT works with the https method, and that CA certificates are installed. | |
| sudo apt-get -y install apt-transport-https ca-certificates | |
| # Add the new GPG key. | |
| sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D |
Note: "Forked" from Latency Numbers Every Programmer Should Know
| Event | Nanoseconds | Microseconds | Milliseconds | Comparison |
|---|---|---|---|---|
| L1 cache reference | 0.5 | - | - | - |
| Branch mispredict | 5.0 | - | - | - |
| L2 cache reference | 7.0 | - | - | 14x L1 cache |
| Mutex lock/unlock | 25.0 | - | - | - |
My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
| const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) | |
| const asyncForEach = async (array, callback) => { | |
| for (let index = 0; index < array.length; index++) { | |
| await callback(array[index], index, array) | |
| } | |
| } | |
| const start = async () => { | |
| await asyncForEach([1, 2, 3], async (num) => { | |
| await waitFor(50) |
| #!/bin/sh | |
| # script to convert mysql schema to be compatible with data warehouse software | |
| # make sure that s3cmd and maatkit utility is installed | |
| db_name=${1:-'test'} | |
| > /root/$db_name.txt | |
| temppath='/mnt/data/pdump1' | |
| host='localhost' | |
| user='maatkit' |
| let re; | |
| //this looks for the string between the slashes. it'll match hello but not HeLlo. | |
| re = /hello/; | |
| //the lower case i means be case insensitive. this will match HellO. | |
| re = /hello/i; | |
| // explaination for common search characters |