上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 18 下一页

[FE] 关于网页的一些反爬手段的解析思路,比如 58 等

摘要: 这里主要是贴一些资料,有兴趣的可以再深入研究,比如做一些自动化库。 www.cnblogs.com/TRHX/p/11740616.html blog.csdn.net/DzzzzzZzzzz/article/details/83473967 Tool:ChatAI Link:https://www 阅读全文
posted @ 2020-06-01 22:36 ercom 阅读(187) 评论(0) 推荐(0)

[Go] 让 go build 生成的可执行文件对 Mac、linux、Windows 平台一致

摘要: 要做到这一点,使用的是交叉编译选项。 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go CGO_ENABLED=0 GOOS= 阅读全文
posted @ 2020-06-01 09:35 ercom 阅读(4791) 评论(0) 推荐(0)

[Go] go build 减小二进制文件大小的几种方式

摘要: 第一种 是去除不需要的调试信息: go build -ldflags "-s -w" main.go 实测 19M 减小为 15M,幅度 2% 第二种 压缩 UPX: the Ultimate Packer for eXecutables 第三种 更新至 go1.15 版本,See here. Re 阅读全文
posted @ 2020-05-30 19:43 ercom 阅读(1685) 评论(0) 推荐(0)

[Gin] gin-jwt 业务逻辑中使用实例化的 middleware 的方式

摘要: 依然需要按文档所示实例化一个 authMiddleware。 在路由组中使用的方式是 authMiddleware.MiddlewareFunc()。 通过追踪 MiddlewareFunc 可以知道一个大概的处理逻辑。 在具体的业务逻辑代码中,注意依然需要使用同一个 authMiddleware 阅读全文
posted @ 2020-05-29 19:40 ercom 阅读(1186) 评论(0) 推荐(0)

[Auth] 浅谈 jwt token 的妙处

摘要: 无状态(易扩展)。 有过期时间限制,相对安全(可以有多个有效的 token)。 更轻量(适合少量信息),类似传统 query string 签名方式。 标准统一(跨语言)。 Refer:JWT Auth Link:https://www.cnblogs.com/farwish/p/12987702. 阅读全文
posted @ 2020-05-29 15:32 ercom 阅读(216) 评论(0) 推荐(0)

[Go] CORS 支持多个 origin 访问的思路 (Access-Control-Allow-Origin 部分)

摘要: 以下为局部伪代码,仅供参考: var allowOrigin string allowOrigins := config.AppConf.Get("middleware.cors.allowOrigins").(string) if strings.Contains(allowOrigins, "* 阅读全文
posted @ 2020-05-29 15:24 ercom 阅读(1731) 评论(0) 推荐(0)

[Go] gorm 返回指定模型数据的处理方式

摘要: 重新 var 声明一个变量,类型为包含指定字段的结构体。 查询的时候,还是使用原始模型类型的变量。 example: // For return data var retMember struct { Hash string `json:"hash"` Name string `json:"name 阅读全文
posted @ 2020-05-27 21:06 ercom 阅读(2628) 评论(0) 推荐(0)

[Go] 浅谈 gorm 执行 AutoMigrate 的两种时机

摘要: 第一种就是直接在操作 model 的逻辑中,执行 db.AutoMigrate,模型没有更新时不会有 schema 相关的 sql 被执行。 第二种就是单独定义一个属于 main 包的 go 文件,专门用于处理 Migrate。 有其它想法可留言讨论。 Refer:GORM奇技淫巧 Refer:ht 阅读全文
posted @ 2020-05-26 19:28 ercom 阅读(5165) 评论(0) 推荐(0)

[FAQ] Error occured while trying to proxy to: xx.xx.x.xx:xx/xx

摘要: 遇到这种情况,要知道证明访问并未到达指定的服务地址。 可能原因有未启动、端口占用 等等,请逐一排查。 Tool:ChatAI Refer:Proxy_Error Link:https://www.cnblogs.com/farwish/p/12966391.html 阅读全文
posted @ 2020-05-26 16:30 ercom 阅读(4913) 评论(0) 推荐(0)

[Docker] 镜像源配置 for Linux

摘要: $ vi /etc/docker/daemon.json { "registry-mirrors": [ "https://docker.mirrors.ustc.edu.cn", "https://registry.docker-cn.com" ], "log-driver": "json-fil 阅读全文
posted @ 2020-05-26 14:17 ercom 阅读(568) 评论(0) 推荐(0)

[Gin] gin-jwt 中间件的请求流程与使用思路

摘要: gin-jwt 中间件是对 jwt-go 的封装以适应 gin 框架。gin-jwt 对不同的请求流程有不同的 handler: 登录请求流程 是用 LoginHandler。 需要 jwt 令牌的后续请求 是用 MiddlewareFunc。 退出请求流程 是用 LogoutHandler。 刷新 阅读全文
posted @ 2020-05-25 22:38 ercom 阅读(1710) 评论(0) 推荐(1)

[PHP] Laravel auth:airlock 更名 auth:sanctum

摘要: 本以为有了一种改善型的服务出来了,没想到不是。 关于 Laravel 现有的三大验证方式看这里:[PHP] 浅谈 Laravel 三大验证方式的区别, auth:api, passport, auth:airlock Link:https://www.cnblogs.com/farwish/p/12 阅读全文
posted @ 2020-05-25 16:14 ercom 阅读(570) 评论(0) 推荐(0)

[Cryptocurrency] okex 获取行情的三种方式, ticker、depth、kline

摘要: 获取行情可以使用 ticker、depth、kline 这三种方式。 ticker 得到的是最新一条的成交价行情数据记录。 depth 得到的是指定条数的包含 成交价格 和 成交数量 的记录。 kline 得到的是指定了 period 的一批行情数据记录,最多1440条,不提供技术指标数据。 比如这 阅读全文
posted @ 2020-05-24 18:55 ercom 阅读(1210) 评论(0) 推荐(0)

[FE] G2Plot 更新图表的两种方式

摘要: 第一种是使用 G2Plot 对象上的 changeData 方法,如果不涉及到全局 title 等这些的更改,可以采用这种方式。 也就是说,只有纯数据方面的变动,使用 changeData 更新图表数据 效率最高。 https://antv-g2plot.gitee.io/zh/examples/l 阅读全文
posted @ 2020-05-24 18:46 ercom 阅读(4529) 评论(0) 推荐(0)

[FE] 推荐两个能全球访问的 CDN 前端资源仓库

摘要: https://unpkg.com/ https://cdnjs.com/ 部分资源库的版本不全。 访问速度请自行评估。 Link:https://www.cnblogs.com/farwish/p/12944662.html 阅读全文
posted @ 2020-05-23 21:57 ercom 阅读(672) 评论(0) 推荐(0)

[FE] G2Plot 在 Vue 中使用 CDN 方式避免构建时增大 js 体积

摘要: 使用 npm、yarn 方式安装的包,虽方便使用,但是会极大增加 vendor.xx.js 体积,拖慢网站运行速度。 以 G2Plot 为例,实际在 build 构建时,会下载一些额外字体到 vendor.xx.js 中。 要解决这个问题,选择引入 CDN 是比较常见的方式,在 Vue 中可以参考如 阅读全文
posted @ 2020-05-23 21:54 ercom 阅读(742) 评论(0) 推荐(0)

[FAQ] JS 时间戳格式化为 date

摘要: 拷贝使用,不用引入第三方库 function formatDate (date = 0, fmt = 'yyyy-MM-dd hh:mm:ss') { date = new Date(+date) if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1 阅读全文
posted @ 2020-05-22 22:09 ercom 阅读(282) 评论(0) 推荐(0)

[FAQ] docker-ce depends on containerd.io, docker-ce depends on docker-ce-cli

摘要: 安装 docker 缺少依赖会提示你安装,一般是以下两个: Package containerd.io is not installed Package docker-ce-cli is not installed. docker 官方 package 下载列表中提供了这两个包。 以 ubuntu1 阅读全文
posted @ 2020-05-22 07:37 ercom 阅读(788) 评论(0) 推荐(0)

[FAQ] Error: Component series.bar not exists. Load it first. (echarts)

摘要: 以上错误出现在使用 echarts 组件时,未导入或者使用不正确的情况下。 检查是否导入 line 或者 bar 这一类具体的 chart,比如: import 'echarts/lib/chart/line' 如果导入了,那么检查是否使用错误的情况。 比如,以下 type 使用的是 bar,但是实 阅读全文
posted @ 2020-05-19 19:04 ercom 阅读(2394) 评论(0) 推荐(0)

[Go] httprouter 自动 OPTIONS 响应 和 CORS

摘要: httprouter 是 Gin framework 使用的路由组件。 要对 OPTIONS 请求自动响应,比如支持 CORS 请求或者设置请求头,可用 Router.GlobalOPTIONS。 router.GlobalOPTIONS = http.HandlerFunc(func(w http 阅读全文
posted @ 2020-05-19 15:11 ercom 阅读(947) 评论(0) 推荐(0)

[Go] 结构体成员的第三个位置上标签的作用

摘要: 结构体成员加了第三个位置的标签,在转换指定类型时,key 会使用指定的名字。 package main import ( "encoding/json" "log" ) type Person struct { Age int FirstName string LastName string `js 阅读全文
posted @ 2020-05-19 14:58 ercom 阅读(412) 评论(0) 推荐(0)

[Go] 结构体 嵌套 结构体指针 的含义

摘要: 举个例子:以下 FutureKline 这个结构体 包含了 Kline 结构体的指针,为什么不直接是 Kline 结构体。 type Kline struct { Pair CurrencyPair Low float64 Vol float64 } type FutureKline struct 阅读全文
posted @ 2020-05-19 14:12 ercom 阅读(1908) 评论(0) 推荐(0)

[ERROR] listen tcp :80: bind: permission denied

摘要: 出现这类提示的时候,表明当前用户没有权限进行 bind 操作。 在某些 Linux 云服务器提供商的运行环境中会出现。 解决方式:使用 sudo 切换为 root,然后在执行原操作。 Refer:listen_tcp_permission_denied Link:https://www.cnblog 阅读全文
posted @ 2020-05-18 22:31 ercom 阅读(6441) 评论(0) 推荐(0)

[FAQ] GitHub 开启二次验证之后,如何通过 https clone 项目 ?

摘要: 在 Github Personal Access Tokens 页面,点击生成一个新的 tokon。 此时使用这个 token 作为用户的密码来 clone 项目。 阅读全文
posted @ 2020-05-17 21:28 ercom 阅读(478) 评论(0) 推荐(0)

[FAQ] GoLand 需要手动开启代码补全吗 ?

摘要: 使用 go mod download 下载模块到本地缓存中,之后 GoLand 就会根据输入自动代码提示。 Other:[FAQ] Goland 始终没有包代码的提示 Link:https://www.cnblogs.com/farwish/p/12906606.html 阅读全文
posted @ 2020-05-17 20:06 ercom 阅读(1896) 评论(0) 推荐(0)

[FAQ] 夏玉米 按规则查询域名靠谱吗 ?

摘要: 很早就有一个网站叫 夏玉米,可以按规则查询和注册域名,那么它真如我们想的那样 可以找到好域名吗? 虽然看起来很好用,实际上夏玉米的查询只是针对它自己的数据库,不包含未在其平台注册的域名,所以大家要失望了。 另外,由于这个站的主要核心就是查询和注册,所以会有很多竞价抢注的人在这上面玩儿,所以即便查到了 阅读全文
posted @ 2020-05-16 17:58 ercom 阅读(250) 评论(0) 推荐(0)

[FAQ] Error: com.mysql.jdbc.Driver not loaded. :jdbc_driver_library

摘要: 以上问题出现在 logstash.conf 未配置好 MySQL 的 JDBC 驱动时导致的错误提示。 首先,下载好 MySQL JDBC 驱动库,可以放到 logstash.conf 所在当前目录或者任意位置。 http://dev.mysql.com/downloads/connector/ 然 阅读全文
posted @ 2020-05-16 17:49 ercom 阅读(655) 评论(0) 推荐(0)

[php-src] Php内核的有趣高频宏

摘要: 内容均以php-5.6.14为例. 1. EXPECTED 和 UNEXPECTED 宏,用在判断条件的时候。 ./Zend/zend.h:390 #if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(DARWIN) && !defined(__ 阅读全文
posted @ 2020-05-14 23:16 ercom 阅读(360) 评论(0) 推荐(0)

[php-src] Php扩展开发的琐碎注意点、细节

摘要: 内容均以php-5.6.14为例. 函数中接收的字符串参数长度不包含结尾的0,在 zend_update_property 中,长度的参数是 int len,一般都使用 ZEND_STRL(NAME)自动填充字符串和长度,它的长度实现是 sizeof(NAME) - 1,它也不需要结尾的0; #un 阅读全文
posted @ 2020-05-14 23:14 ercom 阅读(360) 评论(0) 推荐(0)

[ELK] Docker 运行 Elastic Stack 支持 TLS 的两种简单方式

摘要: 第一种就是 按照官方文档进行配置,指定证书位置开启。 Run the Elastic Stack in Docker with TLS enabled. 第二种就是 9200 端口只暴露给本机,127.0.0.1:9200:9200,外部访问使用反向代理,简化掉自身配置 TLS 这一步。 想要公网 阅读全文
posted @ 2020-05-14 16:33 ercom 阅读(321) 评论(0) 推荐(0)

[MySQL] 导入数据库和表的两种方式

摘要: 如果是导入 mysqldump 导出的 sql 文件,使用 mysql 命令再导入就可以了。 下面是另一种可选方式: use xxdb source /var/lib/mysql/xxtable.sql Refer:还有哪些MySQL导入方法 Link:https://www.cnblogs.com 阅读全文
posted @ 2020-05-12 18:55 ercom 阅读(1663) 评论(0) 推荐(0)

[ELK] 生产环境中 Elasticsearch 的重要配置项

摘要: 配置 Elasticsearch https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html 重要的 Elasticsearch 配置 https://www.elastic.co/guide/en/el 阅读全文
posted @ 2020-05-11 19:48 ercom 阅读(409) 评论(0) 推荐(0)

[ELK] 生产环境使用 Elasticsearch Docker 镜像的优化选项

摘要: 【 配置内核设置 vm.max_map_count 至少为 262144 】 https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#_configuration_files_must_be_readab 阅读全文
posted @ 2020-05-11 17:20 ercom 阅读(1149) 评论(0) 推荐(0)

[FAQ] Python list 的值是带有小括号的是什么意思 ?

摘要: python 中的 list 即列表,是用中括号 [ ] 表示的数组列表; dict 即字典,是用花括号 { } 表示的 json 对象; tuple 即元祖,是用小括号表示的序列; 见到它们之间的组合并不奇怪,比如 [ ('100230343': 100), ('1003234244': 200) 阅读全文
posted @ 2020-05-10 19:55 ercom 阅读(2186) 评论(1) 推荐(1)

[CI/CD] 持续集成 & 持续部署 之 Github Actions

摘要: 1. 配置 ssh 免密登录 看这篇简短的就够了 SSH 免密登录主机/服务器 怎么操作 ? 2. 定义 workflow Github Actions 针对项目语言提供了一系列模板,通过稍加修改并组合一些插件就可以完成基本的集成部署。 比如使用 rsync 部署的插件有 https://githu 阅读全文
posted @ 2020-04-29 20:36 ercom 阅读(654) 评论(0) 推荐(0)

[FAQ] SSH 免密登录主机/服务器 怎么操作 ?

摘要: 1. 生成公私钥对,保存好。 命令:ssh-keygen -t rsa -C "xxx" 2. 将公钥传到远程主机的 ~/.ssh/authorized_keys 之中。 命令:ssh-copy-id -i ~/.ssh/id_rsa.pub -o StrictHostKeyChecking=no 阅读全文
posted @ 2020-04-28 20:25 ercom 阅读(233) 评论(0) 推荐(0)

[Go] 注意 go build -o <output> 选项的准确含义

摘要: -o <output> 选项强制执行把构建的可执行文件写入到目标文件或者目标目录中。 如果 output 是已存在的目录,那么所有构建好的文件都将写入到该目录中。 注意:如果目录不存在的话会报错,会提示 build output "./xx/" already exists and is a dir 阅读全文
posted @ 2020-04-27 14:34 ercom 阅读(9002) 评论(0) 推荐(0)

[K8s] Docker 单节点部署 Rancher

摘要: Rancher 是通过 Web 界面管理 k8s 集群的工具,本身支持使用 Docker 启动。 单节点部署只需要 docker run 即可,易用性高,高可用部署可以使用 nginx 反向代理机制。 以下是单节点部署的可选方式: 1. 默认 Rancher 生成自签证书 $ docker run 阅读全文
posted @ 2020-04-23 22:29 ercom 阅读(1054) 评论(0) 推荐(0)

[BlockChain] 三方互惠是公共区块链得以发展的基石, dApp数字通证的运转需要可持续性玩法

摘要: 公链 旷工 开发者/用户 游戏的可玩儿性、模式 (dApp) 游戏物品、通证 (ERC271 Token) 物品商品、交易所 (OpenSea marketplace) 铸币的时机可以是预铸币,也可以是监听链上事件后触发铸币; 通证的铸币可以是在链上进行的,也可以是链下传参后存储在链上。 Link: 阅读全文
posted @ 2020-04-22 14:40 ercom 阅读(221) 评论(0) 推荐(0)

[Cloud] From Borg to Kubernetes

摘要: Borg System Architect: Kubernetes System Architect: Link:https://www.cnblogs.com/farwish/p/12751861.html 阅读全文
posted @ 2020-04-22 14:29 ercom 阅读(235) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 18 下一页