Skip to content

Instantly share code, notes, and snippets.

View skyitachi's full-sized avatar

skyitachi skyitachi

  • Hangzhou
View GitHub Profile
@skyitachi
skyitachi / function_invocation.js
Created June 19, 2017 02:14 — forked from myshov/function_invocation.js
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@skyitachi
skyitachi / vscode.extention.bak
Created June 28, 2017 09:48
vscode-extensions-backup
EditorConfig.EditorConfig
PeterJausovec.vscode-docker
TwentyChung.jsx
christian-kohler.npm-intellisense
christian-kohler.path-intellisense
dbaeumer.vscode-eslint
donjayamanne.githistory
eg2.tslint
eg2.vscode-npm-script
flowtype.flow-for-vscode
@skyitachi
skyitachi / eslintrc
Created March 22, 2018 03:11
eslint.rc template
{
"extends": "eslint:recommended",
"env": {
"es6": true,
"node": true
}
}
@skyitachi
skyitachi / create_certificate.md
Created March 27, 2018 17:20
create self-signed ssl certificates without passwords

server

echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024

echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr

echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
@skyitachi
skyitachi / timerfd.c
Created July 29, 2018 14:34
timerfd example
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/epoll.h>
#include <sys/timerfd.h>
#include <time.h>
@skyitachi
skyitachi / latency.markdown
Created December 10, 2020 01:47 — 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

@skyitachi
skyitachi / string_test.go
Created February 21, 2021 01:29
slice_convert
package main
import (
"fmt"
"reflect"
"testing"
"unicode/utf8"
"unsafe"
)