各种疑难杂症集合。

/img/tmp/tftz-001.jpg

golang

go get 无法下载问题?

Get https://proxy.golang.org/golang.org/x/tools/gopls/@v/list: dial tcp 172.217.160.81:443: i/o timeout

https://shockerli.net/post/go-get-golang-org-x-solution/

  • export GO111MODULE=on

  • export GOPROXY=https://goproxy.io

emacs

lsp 不能识别 webpack/vite 别名?

Default FAQ js(ts)config for webpack aliases doesn't work. · Issue #890 · vuejs/vetur

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
 "compilerOptions": {
     "target": "esnext",
     "module": "esnext",
     "moduleResolution": "node",
     "strict": true,
     "jsx": "preserve",
     "sourceMap": true,
     "resolveJsonModule": true,
     "esModuleInterop": true,
     "lib": ["esnext", "dom"],
+        "paths": {
+          "@/*": ["src/*"]
+        }
   },
 "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
 }

tsconfig.json 中增加一项配置 paths 告诉 lsp 别名含义。

company-caf error

frontend company-pseudo-tooltip-frontend error - company-mode

But, I suppose I can get in ~/.emacs.d/.local/straight/repos/company-mode and git pull Did this but got this warning You are not currently on a branch. Please specify which branch you want to merge with. See git-pull(1) for details.

=git pull <remote> <branch>=

web

require.cache 缓存问题?

在学习 vue3.0 代码中遇到一个问题,在 org-src-block 中 require vue package 文 件,在修改这个 js 的时候执行 org-src-block 最后的结果怎么都是没修改之前的。

答: 因为 require 之前引入过可能被缓存了起来,可以通过下面的函数来避免引入已缓存的 模块。

1
2
3
4
5

function requireUncached(module) {
  delete require.cache[require.resolve(module)];
  return require(module);
}

即。在 require 之前先删除缓存,然后使用 requireUncached(path) 去引入文件。

怎么在 html 中使用 .svg 文件

1
2
3
4
5
  <img src="your.svg"/>
  <object data="your.svg"/>
   <iframe src="your.svg"/>
   <embed src="your.svg"/>
   <div style="background:url(your.svg)">...</div>
  1. https://vecta.io/blog/best-way-to-embed-svg

google fonts 加速

直连更快…

sitenameping
http://fonts.useso.com360unknown
http://fonts.lug.ustc.edu.cn中科大66ms
http://fonts.css.network捷速网络 香港160ms
http://fonts.gmirror.org七牛timeout

IE8 解决 Object.defineProperty 兼容性问题

typescript

TypeScript error: Property 'X' does not exist on type 'Window'

1
declare const window: any

TS2307: Cannot find module 'X' or its corresponding type declarations.

是因为找不到 vue 文件,直接加上后缀 x.vue 就好了。

macos

Can't delete APFS local snapshots | Apple Developer Forums

$ tmutil thinlocalsnapshots / 999999999999999 4

LaTeX

basictex

Reference ->

$ brew install --cask basictex

安装之后,需要手动安装,不然找不到 pdflatex :

╭─simon@gcl ~
╰─$ pdflatex
zsh: command not found: pdflatex

手动安装过程:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# simon @ gcl in ~ [10:31:59] C:1
$ bash --login                                                                ~

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
gcl:~ simon$ which pdflatex
/Library/TeX/texbin/pdflatex
gcl:~ simon$ cd /usr/local/Caskroom/basictex/
gcl:basictex simon$ ls
2021.0325
gcl:basictex simon$ cd 2021.0325/
gcl:2021.0325 simon$ ls
mactex-basictex-20210325.pkg
gcl:2021.0325 simon$ open mactex-basictex-20210325.pkg

gpg

gpg: Kelly's Passwords: skipped: No public key

❓: 执行 pass insert Email/xxx 的时候报错 gpg: Kelly's Passwords: skipped: No public key gpg: [stdin]: encryption failed: No public key

解决步骤:

  1. $ gpg --full-generate-key

    根据提示输入必要信息完成之后会有如下输出结果:

     Real name: <yourname>
     Email address: address@gmail.com
     Comment: <tipinfo>
     You selected this USER-ID:
         "yourname (tipinfo) <address@gmail.com>"
    
         pub     edxxxx 2021-08-13 [SC]
                     AJGDKJDKJKDJGKJEKGEJKEJGKEJGKEGG
         uid                      yourname (tipinfo) <address@gmail.com>
         sub   cvxxxx 2021-08-13 [E]
    

    结果中 AJGDKJDKJKDJGKJEKGEJKEJGKEJGKEGG 是我们需要的。

  2. $ pass init "AJGDKJDKJKDJGKJEKGEJKEJGKEJGKEGG"

  3. $ pass insert Email/somename

其他

Pulling without specifying how to reconcile divergent branches is … ?

WARNING

hint: Pulling without specifying how to reconcile divergent branches is hint: discouraged. You can squelch this message by running one of the following hint: commands sometime before your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config –global" to set a default hint: preference for all repositories. You can also pass –rebase, –no-rebase, hint: or –ff-only on the command line to override the configured default per hint: invocation.

修复:

1
2
# 全局设置
$ git config --global pull.ff only

kex_exchange_identification: read: Connection reset by peer?

WARNING

$ git clone git@code.aliyun.com:gccll/cloudboss.git Cloning into 'cloudboss'… kex_exchange_identification: read: Connection reset by peer fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

网络问题,直接换个网络就行了。

hugo even 修改 scss 没反应 ?

需要 hugo extended 版本:

1
2
3
4
5
6
7
#/bin/bash

mkdir $HOME/src
cd $HOME/src
git clone https://github.com/gohugoio/hugo.git
cd hugo
go install --tags extended

brew:

1
2
3
$ brew install hugo
$ cd /opt/local/bin
$ ln -s /usr/local/bin/hugo /opt/local/bin/hugo

怎么更新项目中所有的 npm 包?

参考链接。

1
2
3
4
5
   $ npm install -g npm-check-updates
   $ ncu -u
   $ npm update
   $ npm install
   $ ncu -u && npm update && npm install

git ignore 无效(如: .log/)?

1
2
3
4
5
6
7
alias git-ignore-logs="mv .log ~/Desktop && git rm -r .log && git commit -m 'clear logs' && git push"

# commands
$ mv .log ~/Desktop
$ git rm -r .log
$ git commit -m "clear logs"
$ git push

华为手机📱现在哪里去现在谷歌商城?

添加 submodule 失败 ?

  ➜  cheng92.com git:(master) ✗ g-subm-add https://github.com/gcclll/hugo-theme-even.git themes/even
  A git directory for 'themes/even' is found locally with remote(s):
    origin	https://github.com/olOwOlo/hugo-theme-even.git
  If you want to reuse this local git directory instead of cloning again from
    https://github.com/gcclll/hugo-theme-even.git
  use the '--force' option. If the local git directory is not the correct repo
  or you are unsure what this means choose another name with the '--name' option.

本意就是 fork themes/even 出来修改,结果出现问题。

解决方案 1:

  1. $ git ls-files stage themes/even

  2. $ git rm --cached themes/even

  3. $ git submodule add https://github.com/gcclll/hugo-theme-even.git themes/even

解决方案 2:

  1. $ cd .git/modules

  2. $ rm -rf themes/even

  3. $ cd ../..

  4. $ git submodule add https://github.com/gcclll/hugo-theme-even.git themes/even

ssh 登录次数过多问题(many authentication)

$ ssh-add -D 删除认证缓存

macos install adb

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

$ brew cask install android-platform-tools

$ adb devices

批量下载 bilibili 视频(you-get 命令)?

macos in stall java environment ?

https://mkyong.com/java/how-to-install-java-on-mac-osx/

$ brew tap adoptopenjdk/openjdk

$ brew search jdk

$ brew cask install adoptopenjdk11

$ /usr/libexec/java_home -V

$ java -version

git merge 的时候忽略指定文件?

https://www.jianshu.com/p/09b546b936a7

  • $ git config --global merge.ours.driver true

  • $ echo 'index.php merge=ours' >> .gitattributes

  • $ git add .gitattributes

  • $ git commit -m 'chore: Preserve index.php during merges'