Vue 相关资源
Vue - The Complete Guide (incl. Router & Composition API) The Vue.js 3 Masterclass TypeScript Friendly Vue 3 Vue.js Fundamentals
Vue - The Complete Guide (incl. Router & Composition API) The Vue.js 3 Masterclass TypeScript Friendly Vue 3 Vue.js Fundamentals
介绍 // Pipe creates a synchronous in-memory pipe. // It can be used to connect code expecting an io.Reader // with code expecting an io.Writer. // // Reads and Writes on the pipe are matched one to one // except when multiple Reads are needed to consume a single Write. // That is, each Write to the PipeWriter blocks until it has satisfied // one or more Reads from the PipeReader that fully consume // the written data....
go embed 是go 1.16 开始添加的特性,允许嵌入文件及文件夹,在Go程序中进行使用。官方还为此添加了embed.FS的对象。下面将常用的使用场景进行简单列举: 嵌入单个文件 官方的例子 嵌入文件并绑定到字符串变量 import _ "embed" //go:embed hello.txt var s string print(s) 嵌入文件并绑定到字节变量 import _ "embed" //go:embed hello.txt var b []byte print(string(b)) 嵌入文件并绑定到文件对象 import "embed" //go:embed hello.txt var f embed.FS data, _ := f.ReadFile("hello.txt") print(string(data)) 嵌入目录 嵌入时,可以在多行或者一行输入要嵌入的文件和文件夹。 package server import "embed" // content holds our static web server content. //go:embed image/* template/* //go:embed html/index.html var content embed.FS 在匹配文件夹时,embed会嵌入包括子目录下的所有除.和_开头的文件(递归),所以上面的代码大致等价于下面的代码: // content is our static web server content....
Windows下GIT的几个小技巧 记住git密码 使用下面命令可以设置记住git密码,但推荐使用ssh进行操作。 git config credential.helper store 设置换行符转换 在windows下开发时,迁出的代码是CRLF会导致编译的sh脚本不能正确执行: git config --global core.autocrlf false Git推送到多个服务器 要实现一次push到多个远程仓库 本机git仓库A https://aaaaa.git 要同步push的远程git仓库B https://bbbbb.git 通过git remote add添加 先使用git remote -v查看远程仓库的情况 ,然后添加一个git仓库 git remote add b https://bbbbb.git 再次查看远程仓库情况,如果需要push,则需要push两次 通过git remote set-url 添加 如果按上面添加过remote分支,需要先git remote rm b,使用下面命令添加即可。 git remote set-url --add a https://bbbbb.git 查看远程仓库情况,看看是否已经是两个push地址了 。这个只需push一次就行了 修改配置文件 打开 .git/config 找到 [remote “github”],添加对应的 url 即可,效果如下。这种方法其实和方法二是一样的。 [remote "a"] url = https://aaaaa.git fetch = +refs/heads/*:refs/remotes/a/* url = https://bbbbb.git 参考链接 ● 一个项目push到多个远程Git仓库 https://segmentfault....
目的 实现nocopy的目的在于,golang在进行参数传递时,都是传递副本的方式。但是某些情况,我们是需要进行传递对象的引用的(特别是一些指针对象,可能会导致多个指针的副本的操作造成程序陷入恐慌),为了杜绝调用者的复制,只能指针传递全局唯一对象。那么就可以通过添加nocopy来实现对go vet参数支持的no copy 检查。 实现 golang里面最常用的sync.WaitGroup就是通过nocopy实现的。参考定义 // A WaitGroup must not be copied after first use. type WaitGroup struct { noCopy noCopy // 64-bit value: high 32 bits are counter, low 32 bits are waiter count. // 64-bit atomic operations require 64-bit alignment, but 32-bit // compilers do not ensure it. So we allocate 12 bytes and then use // the aligned 8 bytes in them as state, and the other 4 as storage // for the sema....
参考sdk定义 package main import ( "fmt" "regexp" ) // wechat pay 用户付款码条形码规则:18位纯数字,以10、11、12、13、14、15开头 // alipay 支付授权码,25~30开头的长度为16~24位的数字,实际字符串长度以开发者获取的付款码长度为准 func main() { // wechat regwechat:=regexp.MustCompile("^(1[0-5])\\d{16}$") matchwechat := regwechat.MatchString("154658833119096245") fmt.Println(matchwechat) // alipay regalipay:=regexp.MustCompile("^(2[5-9]|30)\\d{14,22}$") matchalipay := regalipay.MatchString("307573774583867517336") fmt.Println(matchalipay) } 参考 微信 支付宝
事故起因 我们公司的应用程序部署目录有个bin目录,手误,删除的时候输入的是/bin 事故现象 ● SSH 不能登陆进来了 ● ls、chmod等常用命令都不能使用了 ● wget 还能用 事故解决 通过查找谷歌,发现有个perl带有提权的功能,简单来说就是 perl -e "chmod 0777, '/bin/ls'" 通过这个方式可以对指定的文件进行权限的修改。于是从另外的机器上打包了一个/bin目录,放到网上,wget 下载到本地wget bin.tar.gz 本机开外网ssh转发,scp 拷贝tar文件到目录,执行 perl -e "chmod 0777, './tar'" ,再使用tar进行文件解压./tar xvzf bin.tar.gz -C /,然后再给chmod执行文件赋予执行权限 perl -e "chmod 0777, '/bin/chmod'" 然后再通过chmod 执行 chmod -R +x /bin/给/bin目录下的可执行程序文件授予执行权限。至此,完成事故修复。 参考连接 ● https://perldoc.perl.org/functions/chmod.html
整理一个列表,持续更新。 理论 ebf官网 B站视频 eBPF 和 Go,超能力组合 实践 Tracing Go Functions with eBPF part1 part2 Getting Started with eBPF and Go Linux中基于eBPF的恶意利用与检测机制 如何用eBPF分析Golang应用 使用BPF, 将Go网络程序的吞吐提升8倍 使用ebpf跟踪rpcx微服务 BPF MAP机制 一种通用数据结构,可以存储不同类型数据的通用数据结构 Andrii Nakryiko 抽象数据容器(abstract data container) bpf系统调用的说明 《使用C语言从头开发一个Hello World级别的eBPF程序》 《Linux Observability with BPF》 《揭秘BPF map前生今世》 bpf系统调用说明 官方bpf map参考手册 bpftool参考手册 《Building BPF applications with libbpf-bootstrap》 https://github.com/DavadDi/bpf_study https://github.com/mikeroyal/eBPF-Guide#go-development golang 包及项目 https://github.com/cilium/ebpf https://github.com/danger-dream/ebpf-firewall https://github.com/mozillazg/hello-libbpfgo
电子书 编写和优化Go代码 Go Optimizations 101 https://github.com/dgryski/go-perfbook https://github.com/DataDog/go-profiler-notes https://github.com/bobstrecansky/HighPerformanceWithGo/ https://github.com/caibirdme/hand-to-hand-optimize-go Tool flameshow goref Go package https://github.com/aclements/go-perf https://github.com/256dpi/god https://github.com/divan/expvarmon https://github.com/go-perf/awesome-go-perf https://github.com/iyashjayesh/monigo 文章 官方博客 Profiling Go Programs Profile-guided optimization https://dave.cheney.net/high-performance-go-workshop/dotgo-paris.html https://github.com/golang/go/wiki/Performance https://sumercip.com/posts/inside-the-go-cpu-profiler/ How to Write Benchmarks in Go : https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go Improving Observability of GoLang Services Debugging performance issues in Go programs : https://github.com/golang/go/wiki/Performance Go execution tracer : https://blog.gopheracademy.com/advent-2017/go-execution-tracer/ (see also the The tracer design doc link) A whirlwind tour of Go’s runtime environment variables (see godebug) : https://dave....
Cap’n proto 号称是比protobuff更快的proto语言。官网截图 Cap’n Proto is an insanely fast data interchange format and capability-based RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster. In fact, in benchmarks, Cap’n Proto is INFINITY TIMES faster than Protocol Buffers. 协议特性 Cap’n Proto’s RPC protocol has the following notable features. Since the protocol is complicated, the feature set has been divided into numbered “levels”, so that implementations may declare which features they have covered by advertising a level number....