Tech

「科技,开发,技术,思考与实践」

Windows OpenSSH

对于较新的 Windows 系统(Windows 10 1809 及之后),是可以开启 OpenSSH Server 功能的,详细的教程可以参考如下的官方文档,本文不再赘述: OpenSSH for Windows overview Get started with OpenSSH for Windows 值得

VSCode Dark+ 终端配色方案

在 VSCode 运行命令 >Generate Color Theme From Current Settings 即可获取当前主题配色。 以下提取自 Dark+ 的终端配色(可直接使用于 Windows Terminal),并略将 Bright White 颜色增亮: 1{ 2 "background": …

JS 关于链式 bind 的操作

在 JS 中可以利用 .bind 的方式重新指定 this 的指向,而级联(链式)的 .bind 并不会奏效,只会绑定第一个 bind 的 this。以下是一种 .bind 的实现: 1if (!Function.prototype.bind) { 2 Function.prototype.bind = function(oThis) { 3 if …

Golang 的 datetime 格式化

Golang 的 datetime 格式化方法并不是其他编程语言中常见的 yyyy-mm-dd hh-mm-ss 类似形式,而是使用 Golang 语言的诞生时间 2006-01-02 15:04:05 -0700 MST 来作为格式化模板。 而在 Golang 的 time 包中,也定义了年、月、日

npm scripts 中的钩子

我们知道,在 package.json 的 scripts 字段可以设置很多自定义命令,然后通过 npm run xxx 来执行。 但值得注意的是如下的情况: 1{ 2 "scripts": { 3 "prebuild": "echo ABC", 4 "build": …

Git 命令对比 Checkout Restore Switch

自 git version 2.23 开始,git 引入了新命令 restore 和 switch。由于 checkout 这个命令能干太多的事情了,所以这两个新命令主要用于分担“责任过重”的 checkout 的语义理解负担

清除 Git 中的 Not Staged Changes 以及 Untracked Files

有时我们想要清理 git 项目中所有没被 commit 的更改,而这又被 git 分为了 not staged changes 以及 untracked files 两种。本文将介绍两个指令来分别清理对应的文件。 Clean All Not Staged Changes