Skip to content

jiajianrong/documents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

均为原创,转载请注明出自(https://github.com/jiajianrong)

node

node使用Promise同步读文件

node同步异步IO示范

nodejs多进程原理1-child_process

nodejs多线程原理2-cluster

nodejs的模块加载:一切你需要了解的都在这里

nodejs debug - 步骤及原理

nodejs错误控制

Middleware 原理 - koa

Middleware 原理 - koa async

cache server 原理

异步err处理

详解 request

详解 stream

file upload demo

nodejs负载均衡

WebSocket链接的负载均衡解决方案

文件描述符

nodejs koa bigpipe 原理

浏览器localstorage缓存静态资源 + 服务器端合并请求

理解tomcat nio

不要阻塞event-loop及worker-pool

详解 Nginx keepalive

Nginx性能优化

提升服务器性能

TCP半连接队列和全连接队列

TCP TIME_WAIT

SSO koa流程

CSRF

手动升级nodejs

miniprogram及webview同步SSO登录信息

react

react diff children - 算法和优化

react 事务机制

Middleware 原理 - redux

reducer与store的本质

React fake 框架

react-router集成antd - 路由方案

react controlled input - 实时错误提示

响应式系统

flex布局

H5监控-性能与错误

babel-webpack

Webpack HMR 原理

Webpack HMR 使用实践

深入理解ES-module

深入理解script加载机理

模板引擎

webpack编译服务端代码-原理

webpack编译服务端代码-实践

algorithm

计算器

str match 暴力

str match kpm

str match kpm next

最小编辑距离

硬币组合 1

硬币组合 1 动态规划

硬币组合 2

有限状态机demo

归并排序

归并硬币组合

归并字母组合

tree遍历

tree 所有路径

tree 最大路径/和

tree 包含

tree 对称

tree 序列化

数组扁平

数组旋转

最长子数组-存在负数

最长子数组-最大和存在限制

自循环

解释器

其他:记录一些常用的命令

mysql:
    show variables like 'character%';
    
Chrome mock Android:
    "D:\Program Files\Google\Chrome\Application\chrome.exe" --user-agent="Android"

npm:
    npm config set prefix "D:\node8\env\node-global"
    npm config set cache  "D:\node8\env\node-cache"
    npm config set tmp    "D:\node8\env\node-tmp"
    
    npm config ls
    npm config ls -l
    
    npm i -g cnpm --registry=https://registry.npm.taobao.org

RegExp:
    "金融街第三方所发生的".replace(/(?<=.{1}).(?=.{1})/g, '*')

shell:
    find /home/work/trace-analysis/new-trace-analysis/infoData/ -name "2017-12*" |awk '{print "rm -rf " $1}'|sh

curl:
    curl "https://xxx/nodeapi/getUserInfo?" -H "content-type: application/x-www-form-urlencoded;charset=utf-8" -H "x-requested-with: Fetch" -H "Cookie: abc=xyz; nodejs_cas=abc;"
    curl http://localhost:8018/nodeapi/getUserInfo --cookie "shiroCookie=a5d36948-2fd9-441b-8d55-ce1721aea048; _ga=GA1.1.800869426.1545637552; nodejs_finsys_cas=f6476bcfddfb72242652f87f7a1e249d; nodejs_finsys_cas.sig=jKWBXYCynFt1hrEh_w4HTaLYys8"
    curl http://localhost:8018/finance/funder/findFunderData?version=1 --cookie "shiroCookie=a5d36948-2fd9-441b-8d55-ce1721aea048; _ga=GA1.1.800869426.1545637552; nodejs_finsys_cas=f6476bcfddfb72242652f87f7a1e249d; nodejs_finsys_cas.sig=jKWBXYCynFt1hrEh_w4HTaLYys8"
    curl http://localhost:8018/order/list          --cookie "shiroCookie=a5d36948-2fd9-441b-8d55-ce1721aea048; _ga=GA1.1.800869426.1545637552; nodejs_finsys_cas=f6476bcfddfb72242652f87f7a1e249d; nodejs_finsys_cas.sig=jKWBXYCynFt1hrEh_w4HTaLYys8" -X POST -d "pageSize=10&currentPage=1&source=-1&buyCity=-1&fundCode=-1&userName=&mobile=&idCardNo=&saleDeparts=-1&saleName=&orderId=&orderType=-1&spCompanyId=-1&beginTime=2018-12-18&endTime=2019-03-18&workflowNodes=-1&nodeStatus=-1&carDetectStatus=-1&increseAmountStatus=-1&advanceLoan=-1&closeStatus=-1&saleDepart=-1"

ab:
    ab -c 5 -n 10 -H "Cookie: shiroCookie=a5d36948-2fd9-441b-8d55-ce1721aea048; _ga=GA1.1.800869426.1545637552; nodejs_finsys_cas=f6476bcfddfb72242652f87f7a1e249d; nodejs_finsys_cas.sig=jKWBXYCynFt1hrEh_w4HTaLYys8" http://localhost:8018/finance/funder/findFunderData?version=1
    ab -c 5 -n 10 -p "D:/ab-post-param.txt" -T "application/x-www-form-urlencoded" -H "Cookie: shiroCookie=a5d36948-2fd9-441b-8d55-ce1721aea048; _ga=GA1.1.800869426.1545637552; nodejs_finsys_cas=f6476bcfddfb72242652f87f7a1e249d; nodejs_finsys_cas.sig=jKWBXYCynFt1hrEh_w4HTaLYys8"  http://localhost:8018/order/list

ab-post-param.txt
    pageSize=10&currentPage=1&source=-1&buyCity=-1&fundCode=-1&userName=&mobile=&idCardNo=&saleDeparts=-1&saleName=&orderId=&orderType=-1&spCompanyId=-1&beginTime=2018-12-18&endTime=2019-03-18&workflowNodes=-1&nodeStatus=-1&carDetectStatus=-1&increseAmountStatus=-1&advanceLoan=-1&closeStatus=-1&saleDepart=-1


on server2, copy a file from server1 to server2:

    login server2
    cd /home/work/.ssh
    ssh-keygen -t rsa
    copy id_rsa.pub content

    login server1
    cd /home/work/.ssh
    touch authorized_keys
    append server2@id_rsa.pub content into authorized_keys
    chmod 600 ~/.ssh/authorized_keys

    login server2
    (10.48.160.26=server1)
    scp work@10.48.160.26:/opt/web.tar.gz /opt/web.tar.gz


ssh-keygen command:

    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    [图解SSH](https://www.jianshu.com/p/33461b619d53)

tar
    tar -czvf a.tar.gz *.html    // 压缩当前目录所有html文件
    tar -czvf a.tar.gz static    // 压缩static目录
    
    tar -xzvf a.tar.gz

git
    基于当前分支master 创建branchA
        git branch branchA
        git checkout branchA
        coding
        git push origin branchA:branchA
        
    将当前分支branchA 合并回master
        当前branchA
        git checkout master
        git merge branchA
        
    将当前分支branchA 合并回master
        页面操作
        git checkout master
        git pull
        
    回退已push的记录
        git log
        git reset --hard <commit-id>
        git push origin HEAD --force

hive建表
    use hdp_ershouche_defaultdb;
    CREATE EXTERNAL TABLE IF NOT EXISTS finance_static_site(json string)
    PARTITIONED BY (day_id string)
    ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
    STORED AS TEXTFILE

hive入表
    use hdp_ershouche_defaultdb;
    alter table hdp_ershouche_defaultdb.finance_static_site add partition(day_id='20190401') location '/home/hdp_ershouche/rawdata/finance_static_site/20190401/';

hive查询
    use hdp_ershouche_defaultdb;
    SELECT * FROM hdp_ershouche_defaultdb.finance_static_site where day_id='20190401'

跨域
    ctx.set('Access-Control-Allow-Origin', ctx.headers.origin);
    ctx.set('Access-Control-Allow-Headers', 'cache-control,content-type,referer-url');
    ctx.set('Access-Control-Allow-Methods', 'OPTIONS,GET,HEAD,PUT,POST,DELETE,PATCH');
    ctx.set('Access-Control-Allow-Credentials', true);

端口|进程
    lsof -i tcp:PORT
    ps -ef|grep PID
    netstat -antup
    ps -eo pid,lstart,cmd|grep node

网络
    sudo iptables -nL
    sudo iptables -I INPUT -p TCP --dport 8080 -j REJECT --reject-with tcp-reset
    sudo iptables -I OUTPUT -p TCP --dport 8080 -j REJECT --reject-with tcp-reset
    sudo iptables -I FORWARD -p TCP --dport 8080 -j REJECT --reject-with tcp-reset
    sudo iptables --flush
    sudo iptables -I INPUT -p TCP --dport 8080 -j DROP
    sudo iptables -I OUTPUT -p TCP --dport 8080 -j DROP
    sudo iptables -I FORWARD -p TCP --dport 8080 -j DROP

docker
    docker rm -f $(docker ps -q)
    sudo kubectl get pod -n mastergo -l app=mysql -o jsonpath='{.items[0].metadata.name}'
    sudo kubectl exec -it $POD_NAME -n mastergo -- sh -c 'mysql -uroot -p'

查看文件大小
    du -ahd 1 . # -a all -h 显示大小时使用 K,M,G 等可读单位 -d 目录深度
    du -ahd 1 /
    du -ad 1 . |sort -nr
    du -ad 1 / |sort -nr
    du -sh /*
    du -sh ./*
    du -s /* |sort -nr
    du -s ./* |sort -nr
    du -sh * | sort -nr
    du -sh /home/admin/* | fgrep G
查看硬盘
    lsblk
查看文件是否被打开
    lsof faas.log
查看文件被哪个进程打开
    lsof | grep faas.log

babel
    babel-cli / babel-core:         命令行/API
    babel-register / babel-node:    编译服务端代码
    babel-polyfill:                  core-js/stable & regenerator-runtime;{useBuiltIns: entry|usage}
    babel-runtime:                   runtime helper & regenerator-runtime;api转换使用局部变量,不修改原型
    babel-plugin-transform-runtime: helpers定义改为引用;自动引用

React
    - TypeScript类型支持
    - 同时支持 Class 与 React.FC 组件
    - 友好的异步操作
    - 支持按需加载
    - 少重复样板代码
    - 符合函数式特性(immutable,computed,memoization...)
    - 支持状态互相依赖
    - 高内聚,低耦合
    - 支持react-router状态管理
    - API清晰简洁
    - 丰富的生态体系

wget安装nodejs
    - dnf info nodejs
    - https://developer.aliyun.com/article/980198
    - wget -c https://npmmirror.com/mirrors/node/v16.15.0/node-v16.15.0-linux-x64.tar.xz
    - tar Jxf node-v16.15.0-linux-x64.tar.xz -C /usr/local/
    - echo "export PATH=/usr/local/node-v16.15.0-linux-x64/bin/:$PATH" >> .bashrc
    - source .bashrc
    - node -v

SQL优化

select someKeys from order_table 
where user_id='1234' 
order by id limit 23000,100;

select a.someKeys from order_table a,
(select id from order_table where user_id='1234' order by id limit 23000,100) b
where a.id=b.id
order by a.id;

About

nodejs react algorithm 技术文章

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published