Skip to content

Commit

Permalink
more articles
Browse files Browse the repository at this point in the history
  • Loading branch information
fengerzh committed Oct 1, 2022
1 parent b96a7e0 commit 5787694
Show file tree
Hide file tree
Showing 12 changed files with 1,022 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
# gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'rouge', '= 3.26.1'
gem 'rouge', '= 3.26.0'
gem 'jekyll-sitemap', '= 1.4.0'

gem "webrick", "~> 1.7"
50 changes: 17 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.4.1)
activesupport (6.0.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
Expand All @@ -18,7 +18,7 @@ GEM
commonmarker (0.17.13)
ruby-enum (~> 0.5)
concurrent-ruby (1.1.9)
dnsruby (1.61.7)
dnsruby (1.61.9)
simpleidn (~> 0.1)
em-websocket (0.5.2)
eventmachine (>= 0.12.9)
Expand All @@ -27,29 +27,14 @@ GEM
ffi (>= 1.15.0)
eventmachine (1.2.7)
execjs (2.8.1)
faraday (1.8.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3)
faraday (2.5.2)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-net_http (3.0.0)
ffi (1.15.4)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (221)
github-pages (222)
github-pages-health-check (= 1.17.9)
jekyll (= 3.9.0)
jekyll-avatar (= 0.7.0)
Expand Down Expand Up @@ -99,7 +84,7 @@ GEM
octokit (~> 4.0)
public_suffix (>= 3.0, < 5.0)
typhoeus (~> 1.3)
html-pipeline (2.14.0)
html-pipeline (2.14.2)
activesupport (>= 2)
nokogiri (>= 1.4)
html-proofer (3.19.2)
Expand Down Expand Up @@ -237,17 +222,16 @@ GEM
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.14.4)
minitest (5.16.3)
multi_json (1.15.0)
multipart-post (2.1.1)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
nokogumbo (2.0.5)
nokogiri (~> 1.8, >= 1.8.4)
octokit (4.21.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
octokit (4.25.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
parallel (1.20.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
Expand All @@ -274,9 +258,9 @@ GEM
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sawyer (0.8.2)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
faraday (>= 0.17.3, < 3)
simpleidn (0.2.1)
unf (~> 0.1.4)
sinatra (1.4.8)
Expand All @@ -296,21 +280,21 @@ GEM
tilt (2.0.10)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.9)
tzinfo (1.2.10)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.8)
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
webrick (1.7.0)
yell (2.2.2)
zeitwerk (2.4.2)
zeitwerk (2.6.1)

PLATFORMS
ruby

DEPENDENCIES
github-pages (~> 221)
github-pages (~> 222)
html-proofer (~> 3.19.0)
jekyll-admin
jekyll-sitemap (= 1.4.0)
Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ github: [metadata]

# User Settings
username: 张京
user_description: 北京企办信息技术有限公司技术副总裁
user_description: 北京联云天下科技有限公司技术副总裁
disqus_username: fengerzh

# Social Media
Expand Down
108 changes: 108 additions & 0 deletions _posts/2019-09-21-fastest-js-framework.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
title: 2019年最快的Javascript框架
image: https://res.cloudinary.com/fengerzh/image/upload/fastest-framework_joqgvx.jpg
category: 编程
tags:
- javascript
description: 来体验一下2019年最快的Javascript框架。
color: black
---

来体验一下`2019`年最快的`Javascript`框架:

![图片描述][1]

速度是纯`nodejs``2`倍,更不用说其他依赖`nodejs`的框架例如`express/koa/hapi`了,根本不值一提,不但如此,性能还能吊打`spring`以及一众`php7`框架。

百闻不如一见,下面我们就来安装尝鲜:

```
npm install -g es4x-pm
```

这就装好了。下面我们来用它创建一个项目,新建一个空文件夹,然后:

```
es4x init
```

项目就建好了。

我们需要写一个最简单的 index.js 文件:

```js
console.log("hello");
```

直接启动吧:

```
yarn start
```

嗯,报了个错误:

```
error package.json: Name can't start with a dot
```

我们`package.json`里的名字不能只是一个点,得改一下:

```
"name": "hello",
```

再次启动,还是启不起,哦,我们还没有安装依赖:

```
yarn add @vertx/core
```

这样就能运行了,但是会报一个警告:

```
ES4X is using graaljs in interpreted mode! Add the JVMCI compiler module in order to run in optimal mode!
```

对于我们这样有洁癖的人不能忍受啊。

这是因为我们现在系统环境里的`Java`还是个旧的`Java`,而`Oracle`最新推出的`Graal`才是最新最好的`Java`,所以我们先安装一下`Graal`:

```
brew cask install graalvm/tap/graalvm-ce
```

再次执行`yarn start`

现在警告也没有了,一切顺利!

试着写点`ES6`的语法:

```
const a = () => {
console.log('hello')
}
a()
```

一样可以顺利执行!

再往后就是生成`http`服务器,连接`mysql`等等,这些就跟其他框架大同小异了,不再细讲。

## 原理

我始终认为,用什么语言根本就是无所谓的,只有外行才讲什么语言是最快的。`JS`慢只是因为底层的`Node`慢,而`Node``V8`引擎又不是拿`JS`写的,而是拿`C++`写的。

现在的这个[es4x][2] ([中文文档][3])它一样能解释`JS`语言,只不过它的底层换成了`Java`,用的是`Eclipse`[Vert.x][4]技术,而原生的`Vert.x`技术用的是`Java`旧版引擎,对`ES6`支持不好,换成`Oracle`最新的[GraalVM][5]就一切都解决了。当然也不能就此说`C++``Java`慢,那样你就又浅薄了。

有人抬杠说`JS`不能写操作系统底层,有什么不能写的?无非就是个语言而已,你把它编译成二进制就什么都能干了,没听说过[nexe][6]吗?

学了编译原理,你就知道语言是什么根本不重要。会说中文的没有必要看不起会说英文的,会说英文的没有必要看不起会说中文的,什么语言好,放在工程项目当中,重要的只是生态,其他都没有可比性。

[1]: https://segmentfault.com/img/bVbxYFf
[2]: https://github.com/reactiverse/es4x
[3]: https://reactiverse.io/es4x/zh/get-started/
[4]: https://github.com/eclipse-vertx/vert.x/
[5]: https://github.com/oracle/graal
[6]: https://github.com/nexe/nexe
150 changes: 150 additions & 0 deletions _posts/2020-07-19-chinese-mirrors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
title: 一站配齐所有国内镜像
image: https://image-static.segmentfault.com/347/504/3475044146-620ef27b108b1_cover
category: 编程
tags:
- javascript
- python
- rust
- php
description: 以下列出我常用的所有国内镜像,方便有类似需求的同学参考。
color: black
---

开发过程中,我们经常会用到各种各样的包管理工具,几乎每种包管理工具缺省设置都是从国外服务器下载相应的软件安装包,或者下载很慢,或者干脆无法下载。以下列出我常用的所有国内镜像,方便有类似需求的同学参考**(不定期更新,感觉有用的同学请注意收藏)**

我平常用的`shell``fish`,所以下面的语法全都是`fish`相关的`set -x`,如果是用缺省的`bash`,可以替换成`export`命令。

# 操作系统相关

## brew 国内镜像

```
cd /usr/local/Homebrew
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
```

```
# brew国内镜像
set -x HOMEBREW_BOTTLE_DOMAIN https://mirrors.ustc.edu.cn/homebrew-bottles
```

# Javascript 相关

## npm 国内镜像

```
npm config set registry https://registry.npm.taobao.org/
```

## yarn 国内镜像

```
yarn config set registry https://registry.npm.taobao.org/
```

## pnpm 国内镜像

```
pnpm config set registry https://registry.npm.taobao.org/
```

## electron 国内镜像

```
yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/
set -x ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/
```

## node-sass 国内镜像

```
yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
set -x SASS_BINARY_SITE https://npm.taobao.org/mirrors/node-sass/
```

## fsevents 国内镜像

```
yarn config set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents/
set -x FSE_BINARY_HOST_MIRROR https://npm.taobao.org/mirrors/fsevents/
```

## 更多

更多设置,或者懒得一个一个设置的同学也可以参考这里:

<https://gist.github.com/hetykai/484209019b1b0d39ea649540e554a0a4>

把这些代码下载到一个 shell 脚本里,一键添加完成。

# Python 相关

## pip 国内镜像

```
$ cat ~/.pip/pip.conf
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
```

## conda 国内镜像

```
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
```

# PHP 相关

## composer 国内镜像

```
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
```

# Rust 相关

## rustup 国内镜像

```
set -x RUSTUP_DIST_SERVER https://mirrors.ustc.edu.cn/rust-static
set -x RUSTUP_UPDATE_ROOT https://mirrors.ustc.edu.cn/rust-static/rustup
```

## cargo 国内镜像

修改当前用户目录下`.cargo/config`文件,改为:

```
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"
```

# 其它语言

## flutter 国内镜像

```
set -x PUB_HOSTED_URL https://pub.flutter-io.cn
set -x FLUTTER_STORAGE_BASE_URL https://storage.flutter-io.cn
```

# 补充

## github 国内镜像

如果是在`git clone`时遇到了问题,可以先在码云建立一个库,来源取自 github,然后同步码云这个库即可。

0 comments on commit 5787694

Please sign in to comment.