202311

整会promise这8个高级用法
https://blog.51cto.com/u_14627797/6989643

promise数组串行执行

const requestAry = [() => api.request1(), () => api.request2(), () => api.request3()];
for (const requestItem of requestAry) {
  await promiseItem();
}

const requestAry = [() => api.request1(), () => api.request2(), () => api.request3()];
const finallyPromise = requestAry.reduce(
    (currentPromise, nextRequest) => currentPromise.then(() => nextRequest()),
    Promise.resolve(); // 创建一个初始promise,用于链接数组内的promise
);

sleep

function sleep(time) {
    return new Promise((resolve) => setTimeout(resolve, time));
}

await sleep(100) // 防止请求发送太快

https://blog.csdn.net/qq_57057576/article/details/125856993

  • 微信小程序中,图片的完全居中显示,line-height并不能发挥效果, line-height可以时内部文字垂直居中显示,但是对于图片并未发挥效果

  • 水平居中显示,可以使用 text-align:center

  • 解决方法:使用flew布局

    display: flex;
    align-items: center;
    justify-content: center;

微信小程序高度height设置百分比无效,只需一步搞定

page{height:100%}

使用 Certbot 为 Nginx 自动配置 SSL 证书
https://blog.csdn.net/qq_34010538/article/details/133825978

sudo apt-get update
sudo apt-get install certbot python3-certbot-nginx

sudo certbot --nginx -d your_domain
sudo certbot renew --dry-run

清理临时文件
https://askubuntu.com/questions/380238/how-to-clean-tmp

sudo find /tmp -type f -atime +10 -delete

https://platform.openai.com/docs/assistants/overview

期货交易生涯中,您遇到哪些契机让你的交易水平发生质的蜕变? - 藏巧守拙的回答 - 知乎
https://www.zhihu.com/question/445059936/answer/2661994653

https://github.com/microsoft/inshellisense
inshellisense provides IDE style autocomplete for shells. It’s a terminal native runtime for autocomplete which has support for 600+ command line tools. inshellisense supports Windows, Linux, & MacOS.

EventSource / Server-Sent Events through Nginx
https://stackoverflow.com/questions/13672743/eventsource-server-sent-events-through-nginx

proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;

How to handle streaming in OpenAI GPT chat completions
https://blog.georgeck.me/how-to-handle-streaming-in-openai-gpt-chat-completions

Here are the main differences:

  • Standard SSE expects GET resources. As you can see, OpenAI expects POST with custom payload.
  • The same API endpoint will respond with content-type: application/json if there are any errors in the API request itself. So, the client will have to handle both types of responses.

english

  • Not only can you make your own GPT for fun or productivity, but you’ll soon be able to publish it on a marketplace they call the GPT Store — and maybe even make a little cash in the process.
  • The new features, announced with many others today at OpenAI’s first developer day in San Francisco, indicate a more hands-off approach to the AI marketplace, which has hitherto been defined by a handful of dedicated general-purpose systems.
  • Indeed, said systems are becoming even more general-purpose with new capabilities, but the AI giant has clearly taken a page from Apple’s book in seeing that being the go-to platform for the ingenuity of others is at least as valuable as having ingenuity oneself.
  • Use Assistant API once it’s released for automatic context retrieval. The Assistant API will create a thread that we can add messages too, to keep the history of actions, but it doesn’t support the Vision API yet.

curl请求IPv6服务(地址)
https://blog.csdn.net/a145127/article/details/127408971

-6 表示使用IPv6的地址
-g 或 --globoff 表示url中允许使用[]
 
curl -6 -g "http://[726c:4666:637f:f130:c92f:5330:6b10:7165]:8080"    

MySQL REGEXP word boundaries [[:<:]] [[:>:]] and double quotes
https://stackoverflow.com/questions/18901704/mysql-regexp-word-boundaries-and-double-quotes

In MySQL up from 8.0.4 use: \\bword\\b

How to declare a variable in MySQL?
https://stackoverflow.com/questions/11754781/how-to-declare-a-variable-in-mysql

MySQL: Selecting multiple fields into multiple variables in a stored procedure
https://stackoverflow.com/questions/2450529/mysql-selecting-multiple-fields-into-multiple-variables-in-a-stored-procedure

SELECT Id, dateCreated
INTO iId, dCreate
FROM products
WHERE pName = iName

Flink的DAG可视化开发实践
链接:https://www.jianshu.com/p/9662f6a65cd8

离线分析之所以适合用DAG进行开发,是因为它的主要逻辑表达语言工具是SQL,再辅以循环、分支、归并等结构,更复杂的情况可以用MR和Python节点解决,这样几乎能完全适应所有离线分析的场景。而Flink虽然支持FlinkQL,但是它在实际工作场景下的适用性太弱了,关键的原因就在于离线分析是属于统计,而流式计算式是计算。SQL擅长统计,但并不适合计算(离线分析中复杂点的计算也基本用UDF来做)。

Flink之所以难以用DAG可视化开发,关键的问题就是它的算子只定义了基本特性,内部的逻辑完全自由。这种自由定义,对纯代码开发来说是可以的且强大的,但却对可视化开发不友好。如果可视化仅仅是拖出一个节点来,然后在里面用Java/Scala实现特定的方法,那这就不是可视化开发了,而是另一种Flink专用IDE了。

https://www.yuque.com/boyan-avfmj/aviatorscript/guhmrc
Aviator 起源于 2010 年左右,当时我还在淘宝中间件,读了龙书,了解了 ASM ,开始读 clojure 编译器的源码。刚好同时在做 Notify 这个内部消息中间件的一个重要版本实现,其中有一个需求是实现 AMQP 规范里的 header 订阅,允许用户指定一个布尔表达式来决定是否订阅某种类型的消息,需要对布尔表达式字符串进行求值。当时正处于造轮子的兴奋期,因此就写了第一个版本出来,第一个版本花了一两天的功夫,整个代码结构其实到现在也没有特别大的改变,还是那么乱 :)

数据仓库 ,由数据仓库之父比尔·恩门(Bill Inmon)于1990年提出的。 1991年,他写了一本书,叫《Building the Data Warehouse》(建立数据仓库),书中提出的:
数据仓库(Data Warehouse)是一个

  • 面向主题的(Subject Oriented)、
  • 集成的(Integrated)、
  • 不可修改的(Non-Volatile)、
  • 与时间相关的(Time Variant)的数据集合,
  • 专门用于支持管理决策(Decision Making Support)。

ClickHouse is a column-oriented database management system (DBMS) for online analytical processing of queries (OLAP).

场景特征:

大多数是读请求
数据总是以相当大的批(> 1000 rows)进行写入
不修改已添加的数据
每次查询都从数据库中读取大量的行,但是同时又仅需要少量的列
宽表,即每个表包含着大量的列
较少的查询(通常每台服务器每秒数百个查询或更少)
对于简单查询,允许延迟大约50毫秒
列中的数据相对较小:数字和短字符串(例如,每个URL 60个字节)
处理单个查询时需要高吞吐量(每个服务器每秒高达数十亿行)
事务不是必须的
对数据一致性要求低
每一个查询除了一个大表外都很小
查询结果明显小于源数据,换句话说,数据被过滤或聚合后能够被盛放在单台服务器的内存中
clickhouse自身限制:

不支持真正的删除/更新支持 不支持事务
不支持二级索引
有限的SQL支持,join实现与众不同
不支持窗口功能
元数据管理需要人工干预维护

链接:https://www.jianshu.com/p/7ec2cc9a4069

实时数仓方案如何选型和构建
原文链接:https://blog.csdn.net/weixin_43597208/article/details/126355132

这种方案的好处有二,方案简单;数据实时。不过有两个缺点:

一个是用户每产生一个新的报表需求,都需要开发一个Flink流式计算任务,数据开发的人力成本和时间成本都较高。

第二个是对于每天需要接入近百亿的数据平台,如果要分析近一个月的数据,则需要的Flink集群规模要求很大,且需要将很多计算的中间数据存储在内存中以便多流Join。

大数据分析使用哪些工具? - Smartbi的回答 - 知乎
https://www.zhihu.com/question/415610563/answer/3255681655

28、实时用户画像之任务调度DS之Flink任务实战讲解
https://edu.51cto.com/lesson/781871.html

markmap 这个名字是 Markdown 和 Mindmap 的组合
https://markmap.js.org/repl

python3网络编程
https://0xbharath.github.io/python-network-programming/protocols/dns/index.html

Setting Up V2Ray with NGINX + WebSocket + TLS
https://tofu.icu/archives/13

bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
apt update
apt install nginx certbot python3-certbot-nginx
vi /usr/local/etc/v2ray/config.json

{
  "inbounds": [
    {
      "port": 10000,
      "listen":"127.0.0.1",
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "your-uuid",
            "alterId": 0
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
        "path": "/yourpath/"
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}

certbot certonly --nginx -d example.com

server {
  listen 443 ssl;
  listen [::]:443 ssl;

  ssl_certificate       /path/to/your/certificate;
  ssl_certificate_key   /path/to/your/certificate_key;
  ssl_session_timeout 1d;
  ssl_session_cache shared:MozSSL:10m;
  ssl_session_tickets off;

  ssl_protocols         TLSv1.2 TLSv1.3;
  ssl_ciphers           ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
  ssl_prefer_server_ciphers off;

  server_name           example.com;
  location /yourpath/ {
    if ($http_upgrade != "websocket") {
        return 404;
    }
    proxy_redirect off;
    proxy_pass http://127.0.0.1:10000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
    # Show real IP in v2ray access.log
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

service nginx restart

Disable Python’s output buffering with sys.stdout.flush() or -u command line option.
https://python-code.dev/articles/3750

import os
import sys

if not os.environ.get("PYTHONUNBUFFERED"):
    os.environ["PYTHONUNBUFFERED"] = "1"
    os.execv(sys.executable, [sys.executable] + sys.argv)

print("This message will be printed without buffering")

What Is Python Output Buffering and How to Disable It?
https://blog.finxter.com/what-is-python-output-buffering-and-how-to-disable-it/

import io
import os
import sys
import time

try:
    # open stdout in binary mode, then wrap it in a TextIOWrapper and enable write_through
    sys.stdout = io.TextIOWrapper(open(sys.stdout.fileno(), 'wb', 0), write_through=True)
    # for flushing on newlines only use :
    # sys.stdout.reconfigure(line_buffering=True)
except TypeError:
    # In case you are on Python 2
    sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)

How to Check if Python’s Output Buffering Is Enabled
https://adamj.eu/tech/2020/06/26/how-to-check-if-pythons-output-buffering-is-enabled/

import io
import sys

def output_buffering_enabled():
    return isinstance(sys.__stdout__.buffer, io.BufferedWriter)

Resume Matcher is an open source, free tool to improve your resume. It works by using language models to compare and rank resumes with job descriptions.

www.resumematcher.fyi/

有哪些命令行的软件堪称神器? - HelloGitHub的回答 - 知乎
https://www.zhihu.com/question/59227720/answer/2644274078

滴滴弹性云基于 K8S 的调度实践
https://mp.weixin.qq.com/s/nMSIsS72fSXGqJO9Vy_Pfw

https://sendgrid.com/en-us/marketing/sendgrid-vs-amazon-ses

Nginx 中运行 JavaScript
https://zhuanlan.zhihu.com/p/393788937

https://github.com/nginx/njs/issues/179

While OpenResty is mature and a great tool to use, we decided to implement our own scripting for nginx for several reason.

njs is tailored to be executed inside nginx (fast VM creation/destroying), lua may have GC issues under heavy load.
lua adds a lot of ad-hoc features (directives, lua methods), njs strives for simplicity using powerful native nginx primitives (variables, subrequests).
njs is a pure nginx module, OpenResty is a set of patches which sometime abuses original nginx design.
we need our own scripting for nginx-plus (paid version) features.
While we already use njs for production it is still in early phase and lacks many features which OpenResty has. BTW we do not plan to implement everything lua/openresty has because the design philosophy is different.

Modern C++ Programming Course (C++11/14/17/20)
https://github.com/federico-busato/Modern-CPP-Programming

12 Lessons, Get Started Building with Generative AI
https://microsoft.github.io/generative-ai-for-beginners/

Longhorn is a distributed block storage system for Kubernetes. Longhorn is cloud-native storage built using Kubernetes and container primitives.
https://github.com/longhorn/longhorn

Go 语言 | 1.16 新增的embed在各流行Web框架中的应用
https://zhuanlan.zhihu.com/p/372800639

解决:

go get -u "github.com/gin-gonic/gin"

报错:

go: module github.com/gin-gonic/gin: Get "https://proxy.golang.org/github.com/gin-gonic/gin/@v/list": dial tcp 142.251.43.17:443: i/o timeout

解决:可以使用国内代理

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

go get -u "github.com/gin-gonic/gin"

Golang gin框架
https://blog.csdn.net/book_longker/article/details/123760632

golang微框架Gin
https://blog.csdn.net/qq_46079238/article/details/130780276

gin 打包静态文件·
https://www.jianshu.com/p/448c6ef02bc8

Golang微服务框架居然可以开发单体应用?—— Kratos单体架构实践
https://www.jianshu.com/p/c541e7b73c3d

从微信后端仓库发展史谈谈单仓和多仓
https://mp.weixin.qq.com/s/S2vcMTpLJpMREC6UoAGJmQ

Java快速创建http/https服务器
https://blog.csdn.net/qq_18497293/article/details/128019269

PyQt5-无边框窗体的移动实现
https://www.sumver.cn/archives/955/

Python搭建悬浮窗口
https://www.python100.com/html/EKRD86544Y9L.html

https://zhuanlan.zhihu.com/p/659744471?utm_id=0

20个堪比 Everything 的 Windows 实用小工具推荐

  • 文档名搜索神器:Everything
  • 文件管理和快速启动器:Listary
  • 全文搜索利器:AnyTXT Searcher
  • 格式最全的阅读器:SumatraPDF
  • 剪贴板历史:Ditto
  • 快速看图:Honeyview
  • 系统优化利器:Dism++
  • 软件卸载:GeekUninstaller
  • 窗口置顶显示:Window TopMost Control
  • 网络下载神器:IDM
  • 新一代效率利器:Quicker
  • 批量重命名:Advanced Renamer
  • 截图贴图神器:Snipaste
  • 速度最快的文本编辑器:EmEditor
  • 电脑上的瑞士军刀:DesktopOK
  • 电脑分区&数据恢复:DiskGenius
  • 护眼神器:f.lux
  • 镜像制作:Rufus
  • 快速预览文件:QuickLook
  • Windows 官方外挂:PowerToys

AI绘画软件Fooocus教程
https://zhuanlan.zhihu.com/p/656708919https://zhuanlan.zhihu.com/p/656708919