前端开发者说

记录开发的故事

  • 首页
  • 归档
  • 标签
  • 搜索
close

清空 git 的 commit 记录

发表于 2019-03-03   |  

有时候 git 提交不该提交的内容或者有些 log 过于多余,在我的博客提交记录含有草稿文件,先抹去这些提交记录。本文介绍如何初始化 git commit log。

是不是很干净呢?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ git checkout --orphan empty-branch
$ git branch
$ git status
$ git rm --cached -rf themes
$ git diff
$ git add .
$ git commit -n -m 'init git log'
$ git checkout dev
$ git checkout -b dev-bak
$ git checkout empty-branch
$ git status
$ git branch -D dev
# 重命名分支
$ git branch -m dev
$ git log
$ git push -f origin dev

Sublime 的列选择

以上内容来自 history,那么多行进行多行编辑呢?
Ctrl + Shift + Up。当然相同内容可以使用 Command + D

更多内容可以点击列选择 - Sublime Text 3 文档

VSCode 的列选择

option + 鼠标点选

option + shift + 鼠标拖动

同时也可以设置快捷键同 Sublime

更多内容可以点击怎样在 VSCode 中进行列选择? - 知乎

centos如何升级nodejs

发表于 2018-07-08   |  

更新日志

curl –silent –location https://rpm.nodesource.com/setup_8.x | sudo bash -
yum -y install nodejs
记得删除老版本的npm node
rm /usr/local/bin/npm

yum remove nodesource-release nodejs
yum clean all
rm -rf /var/cache/yum/

rm /etc/yum.repos.d/nodesource-el.repo
yum -y remove nodejs

参考

node如何设置process.env

发表于 2018-07-08   |  

在使用debug需要设置$env:DEBUG = "*,-not_this"执行相应的环境。

echo $DEBUG输出相应的环境配置。Mac下是可以使用DEBUG="*" node bin/before-parse.js。

https://github.com/visionmedia/debug/blob/master/src/node.js

“dev-mac”: “ export NODE_ENV=development&& nodemon –harmony –use_strict index.js -w “,
“dev-win”: “ set NODE_ENV=development&& nodemon –harmony –use_strict index.js -w “,

windows 不太清楚,*NIX 系统下规则如下:
export NODE_ENV=production && node xxx.js 这样在当前命令行下后续的命令中读取 NODE_ENV,都会得到 production 值;
如果直接使用 NODE_ENV=production node xxx.js,则 NODE_ENV 的有效性仅限当前命令,不会对后续命令有影响。

可以使用cross-env

  • http://sorex.cnblogs.com/p/6200940.html
  • http://yijiebuyi.com/blog/1bfcf43248a873b39a3471901e764b68.html

docker-start

发表于 2018-06-24   |  

给一个正在运行的Docker容器动态添加Volume http://dockone.io/article/149
https://blog.csdn.net/dream_broken/article/details/52314993
https://deepzz.com/post/the-docker-volumes-basic.html

docker machine 静态ip

  • https://github.com/fivestars/docker-machine-ipconfig

docke固定ip https://github.com/johnnian/Blog/issues/16

docker run -itd –network bridge –ip 192.168.3.88 springjk/webdev /bin/bash

docker run -itd –network host –ip 192.168.3.88 springjk/webdev /bin/bash

docker: Error response from daemon: user specified IP address is supported on user defined networks only.

larvel 环境

ssh登录 docker exec -it de1aeb89e0f5 /bin/bash
https://blog.csdn.net/qq_34021712/article/details/73379851

docker镜像位置:

For someone who is using Docker toolbox (that uses docker-machine), the answers concerning boot2docker on Mac OS X is not valid. The docker-machine VM is called “default” and it exists in the /Users//.docker/machine/machines/default/ directory.

docker image是什么,存储在什么位置

ps -u $USER | grep Docker
docker镜像地址 /Users/{YourUserName}/Library/Containers/com.docker.docker/Data

下载地址: https://www.docker.com/community-edition#/download
https://github.com/docker/kitematic/releases

rsync

常见问题

更新日志

参考

Mac配置终端梯子

发表于 2018-06-23   |  

最初的起因是由于https://gist.github.com/作为submodule的时候无法更新,于是想到终端配置访问该网站。最初以为ShadowsocksX-NG配置全局代理就可以,然后并无软用。

首先你得有相关的ss账号,可以自己部署,也可以购买相关的服务。

ss服务

1
$ sublime ~/.zshrc

相关的配置信息可以从这里获取

方法1:

1
2
export http_proxy=http://127.0.0.1:1087
export https_proxy=http://127.0.0.1:1087

方法2:

1
export ALL_PROXY=socks5://127.0.0.1:1086
1
2
$ source ~/.zshrc
$ curl www.google.com

另外推荐httpie。在终端使用http命令,调试api接口

HTTPie—aitch-tee-tee-pie—is a command line HTTP client with an intuitive UI, JSON support, syntax highlighting, wget-like downloads, plugins, and more.

1
$ brew install httpie

ss服务推荐

  • 吾皇 http://kingfast.club/index.php/index/register/?yqi=6711 可按月按年按流量付费,价格实惠,就光查阅资料够用
  • https://www.vultr.com/?ref=7872193-4F 需要自己搭建。参考教程自建ss服务器教程 · Alvin9999/new-pac Wiki 轻松在 VPS 搭建 Shadowsocks 翻墙 ($5/月 支付宝) - DiyCode
  • linode
  • https://www.yunti.website/
  • https://pandafan.im/ 同事用过
  • 多态 体验过一个月,有多终端App
  • https://monocloud.me/ 借同事的账号用过,速度还不错
  • ~鱼摆摆~

相关教程

  • https://github.com/Alvin9999/new-pac/wiki/自建ss服务器教程
  • https://www.diycode.cc/topics/738?from=groupmessage&isappinstalled=0

客户端

  • wingy
  • GoAgentX
  • ShadowsocksX / ShadowsocksX-NG-R8

其他相关的软件

以下并未实践过,看到关键词做个简单的记录

  • Proxifier
  • privoxy http://blog.devtang.com/2012/12/08/use-privoxy/
  • proxychains-ng

使用wepy开发小程序总结

发表于 2018-04-07   |  

使用wepy开发小程序效率提升了很多,相比使用小程序原生框架开发,开发体验提升了好几个等级。如果是从Vue过来的,可能会对wepy部分语法不熟悉,导致自己掉进想当然(Vue习惯的写法)的坑里,所以还是要熟读wepy的文档,理解一些新的概念。我个人觉得wepy是类Vue。mpvue跟Vue更加亲一些。当然还是要感谢作者@Gcaufy提供这么好的框架,这也是为何个人项目会收入到公司项目的原因吧。

阅读全文 »

利用trivas自动部署hexo的blog

发表于 2018-04-06   |  

是什么原因让你折腾travis?是懒!懒!懒!每次提交代码后台又要手动输一次hexo d -g,真心觉得麻烦,作为程序猿,就应该学会偷懒,可以少输几次相同的命令,心情甚是愉悦。

当然之前也有接触过travis,比如x-citravis的简单使用,团队博客的部署。

阅读全文 »

App呼起京东和淘宝指定的页面

发表于 2018-04-01   |  

需求: 需要在自己的App直接打开京东和淘宝指定的页面。

阅读全文 »

前端精彩文章收集

发表于 2018-04-01   |  
本文收集整理优秀的前端资源。
阅读全文 »

Object.assign引起的页面显示空白

发表于 2018-03-29   |  

线上的页面在华为的设备出现空白,通过真机调试发现报错如下:

1
Uncaught TypeError: Object function Object() { [native code] } has no method 'assign'

解决版本

1
import 'core-js/fn/object/assign';

其他相关问题解决

ant-design 直接使用Object.assign 有兼容性问题(Android5,iOS8.4) #87

统一使用 object-assign

How do I get Object.assign to work with 6to5 polyfill?

兼容性

  • https://kangax.github.io/compat-table/es6/#test-Proxy,_internal_'get'_calls_Object.assign
  • https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
  • 浏览器es支持检测

自动化打包App

发表于 2018-03-29   |  

jenkins安装

cocoapods

xcodebuild

1
$ pod update --verbose --no-repo-update

推荐阅读

文档

unit-test

发表于 2018-03-27   |  

测试框架

  • karma
  • https://mochajs.org
  • Jasmine
  • Qunit
  • JsTestDriver
  • JSUnit
  • https://github.com/totorojs/totoro

测试框架对比

  • Javascript单元测试框架Qunit和Jasmine的比较

断言库

  • chai

教程

  • ruanyf/mocha-demos 测试框架 Mocha 实例教程
  • http://wiki.jikexueyuan.com/project/node-lessons/mocha-chai-phantomjs.html

BDD / TDD区别

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// TDD
suite('Array', function() {
setup(function() {
});

test('equal -1 when index beyond array length', function() {
assert.equal(-1, [1,2,3].indexOf(4));
});
});

// BDD
describe('Array', function() {
before(function() {
});

it('should return -1 when no such index', function() {
[1,2,3].indexOf(4).should.equal(-1);
});
});

来自: http://taobaofed.org/blog/2015/12/10/nodejs-unit-tests/

  • 关于TDD、BDD和DDD的一些看法
  • TDD与BDD的差别

覆盖率

  • istanbul

问题

-- recursive执行子目录

Mocha默认运行test子目录里面的测试脚本。所以,一般都会把测试脚本放在test目录里面,然后执行mocha就不需要参数了。

mocha.opts

api 接口测试

  • 接口测试 测试来带个节奏之 API 测试工具篇
  • http://pythonhackers.com/p/tsq/node-autotest
  • 让你的 Node.js 应用接口稳如狗:如何使用 Mocha, Chai 和 SuperTest 写测试代码
  • https://www.npmjs.com/package/moa-api
  • API自动化测试利器——Postman
  • casperjs+mocha+chai搭建E2E测试环境

相关文档

  • Mocha.js官方文档翻译 —— 简单、灵活、有趣
  • 在Node.js上用什么测试框架好?
  • 虚拟座谈会:代码测试比率、测试驱动开发及行为驱动开发
  • 如何进行前端自动化测试?
  • 前端单元测试探索
  • 前端自动化测试工具总结
  • 前端测试工具集锦

其他

  • sinon
  • https://github.com/visionmedia/superagent/tree/master/test/node
  • supertest

mocha

发表于 2018-03-27   |  

例子

  • https://github.com/huixisheng/lab/tree/master/test
  • https://github.com/ruanyf/mocha-demos
  • https://github.com/mochajs/mocha/tree/master/test
  • https://github.com/vuejs/vue-test-utils-mocha-webpack-example
  • https://github.com/mochajs/mocha/tree/f24607e6b04d129610613592d19f5a5af9b65d51/docs/example
  • https://github.com/airware/webdriver-mocha-async-await-example

其他关键词

  • SuperTest
  • Istanbul
  • Magnum CI
  • superagent http://visionmedia.github.io/superagent/
  • karma
  • casperjs

碰到的问题

如何测试es6的module

出现如下报错

1
2
3
4
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)

1
$ ./node_modules/mocha/bin/mocha --require babel-register --require babel-polyfill

mocha --compilers js:babel-register 已经废弃。具体见compilers deprecation

相关issue SyntaxError: Unexpected token import #3228 ES6 import not working when using babel in Mocha. #2655 Babel unexpected token import when running mocha tests

Move the invocation into the parens that contain the function wrap-iife

异步的回调没有添加done()

1
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

如果确实耗时过长的的设置--timeout,this.timeout(3000);

相关issue timeout of 2000ms exceeded. Ensure the done() callback is being called in this test. #2025

其他

ReferenceError: window is not defined

  • https://www.npmjs.com/package/mocha-jsdom

get request
(node:13054) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 63): [object Object]

  • https://objcer.com/2017/12/27/unhandled-promise-rejections-in-node-js/
  • https://github.com/mochajs/mocha/issues/2797
  • https://github.com/mochajs/mocha/issues/3097
  • http://thecodebarbarian.com/unhandled-promise-rejections-in-node.js.html

推荐阅读

  • http://zhouqing86.github.io/2017/03/26/js-test4-mocha/#%E5%BC%95%E5%85%A5babel%E6%B5%8B%E8%AF%95es6
  • http://www.dengzhr.com/node-js/1282
  • Vue.js学习系列六 —— Vue单元测试Karma+Mocha学习笔记
  • 搭建 基于 Mocha + Webpack2 + Chai + ES6 前端单元测试
  • http://blog.kazaff.me/2016/08/24/casperjs+mocha+chai%E6%90%AD%E5%BB%BAE2E%E6%B5%8B%E8%AF%95%E7%8E%AF%E5%A2%83/
  • http://zoucz.com/blog/2016/08/02/nodejs-unittest-mochajs/
  • https://github.com/jin5354/404forest/issues/47

参考文档

  • https://mochajs.org/
  • http://www.chaijs.com/guide/styles/
  • Chai.js cheatsheet
  • Mocha中文文档(翻译) https://www.jianshu.com/p/9c78548caffa

简单介绍cnpmjs安装和碰到的问题

发表于 2018-03-27   |  

cnpmjs 可用于企业的前端私有包管理。淘宝NPM镜像就是用这个搭建的。

npmjs私有包是要收费的,对于公司而言更倾向于自己部署,一是省钱,二是一些含有敏感内容的包放到其他平时总是不放心。

本文将简单记录下实际安装过程中碰到的问题,基本的安装可以移步官方文档。

安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$ yum install -y nodejs
$ yun install git
$ git clone git://github.com/cnpm/cnpmjs.org.git $HOME/cnpmjs.org

# centos7 安装失败
$ yum install mysql mysql-server

$ yum update
$ yum localinstall mysql-community-release-el7-5.noarch.rpm
$ yum repolist enabled | grep "mysql.*-community.*"
$ yum repolist all | grep mysql
$ yum-config-manager --disable mysql56-community
$ sudo yum search yum-config-manager
$ yum install yum-utils
$ yum-config-manager --disable mysql56-community
$ yum-config-manager --enable mysql57-community-dmr
$ yum repolist all | grep mysql
$ yum repolist enabled | grep mysql
$ yum install mysql-serve

# centos7 相关mysql命令
$ service mysqld status
$ service mysqld stop
$ service mysqld start

# centos7 关闭防火墙 #
$ systemctl stop firewalld.service
$ systemctl disable firewalld.service #禁止firewall开机启动
$ systemctl stop firewall // centos7以下的版本命令

以上部分命令来源于网络,时隔太久,找不到相关的出处,😶。

发布的模块npm install 报错

1
2
3
4
5
6
7
8
9
10
11
[npminstall:get] retry GET http://xx.xx.xx.xx:7001xx-debug after 100ms, retry left 4, error: SyntaxError: Unexpected token l in JSON at position 0
...
SyntaxError: Unexpected token l in JSON at position 0
at JSON.parse (<anonymous>)
at _get (/usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/get.js:70:26)
at _get.next (<anonymous>)
at onFulfilled (/usr/local/lib/node_modules/cnpm/node_modules/co/index.js:65:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
npminstall version: 3.2.1
...

发现原因是npm>=5.6的时候有这个问题

1
2
3
4
5
➜  huixisheng.github.com git:(dev) ✗ npm -v
5.4.1
➜ huixisheng.github.com git:(dev) ✗ cnpm -v
cnpm@5.1.1 (/usr/local/lib/node_modules/cnpm/lib/parse_argv.js)
npm@5.6.0 (/usr/local/lib/node_modules/cnpm/node_modules/npm/lib/npm.js)

  • https://github.com/cnpm/cnpmjs.org/issues/1110

配置修改

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
   /**
* Cluster mode
*/
- enableCluster: false,
+ enableCluster: true,
numCPUs: os.cpus().length,

/*
@@ -27,7 +27,7 @@ var config = {

registryPort: 7001,
webPort: 7002,
// 用于外部ip访问
- bindingHost: '127.0.0.1', // only binding on 127.0.0.1 for local access
+ //bindingHost: '127.0.0.1', // only binding on 127.0.0.1 for local access

// debug mode
// if in debug mode, some middleware like limit wont load
@@ -62,10 +62,14 @@ var config = {

// default system admins
admins: {
+ huixisheng: 'huixisheng@gmail.com'
},

// email notification for errors
@@ -98,13 +102,13 @@ var config = {
*/

database: {
- db: 'cnpmjs_test',
+ db: 'cnpm',
username: 'root',
- password: '',
+ password: 'mysqlpassword',

// the sql dialect of the database
// - currently supported: 'mysql', 'sqlite', 'postgres', 'mariadb'
- dialect: 'sqlite',
+ dialect: 'mysql',

// custom host; default: 127.0.0.1
host: '127.0.0.1',
@@ -135,7 +139,8 @@ var config = {
downloadRedirectToNFS: false,

// registry url name
- registryHost: 'r.cnpmjs.org',
+ registryHost: 'xx.xx.xx.xx:7001',
+ // registryHost: 'r.cnpmjs.org',

/**
* registry mode config
@@ -144,11 +149,11 @@ var config = {
// enable private mode or not
// private mode: only admins can publish, other users just can sync package from source npm
// public mode: all users can publish
- enablePrivate: false,
// 注册用户才可以发布模块
+ enablePrivate: true,

// registry scopes, if don't set, means do not support scopes
- scopes: [ '@cnpm', '@cnpmtest', '@cnpm-test' ],
-
+ // scopes: [ '@cnpm', '@cnpmtest', '@cnpm-test', '@cosme' ],
+ scopes: [],
// some registry already have some private packages in global scope
// but we want to treat them as scoped private packages,
// so you can use this white list.
@@ -169,6 +174,7 @@ var config = {
// If you want to directly sync from official npm's registry
// please drop them an email first
sourceNpmRegistry: 'https://registry.npm.taobao.org',
+ // sourceNpmRegistry: 'http://xx.xx.xx.xx:7001',

// upstream registry is base on cnpm/cnpmjs.org or not
// if your upstream is official npm registry, please turn it off
@@ -197,8 +203,6 @@ var config = {

// sync devDependencies or not, default is false
syncDevDependencies: false,
- // try to remove all deleted versions from original registry
- syncDeletedVersions: true,

// changes streaming sync
syncChangesStream: false,
@@ -215,7 +219,7 @@ var config = {

// always-auth https://docs.npmjs.com/misc/config#always-auth
// Force npm to always require authentication when accessing the registry, even for GET requests.
- alwaysAuth: false,
// 命令安装的时候也要输入命名
+ alwaysAuth: true,

// if you're behind firewall, need to request through http proxy, please set this
// e.g.: `httpProxy: 'http://proxy.mycompany.com:8080'`
diff --git a/cnpmjs.org/servers/registry.js b/cnpmjs.org/servers/registry.js
index d2758e5..2d67184 100644
--- a/cnpmjs.org/servers/registry.js
+++ b/cnpmjs.org/servers/registry.js
@@ -34,7 +34,7 @@ app.use(cors({
allowMethods: 'GET,HEAD',
}));
// 关闭用户注册接口
app.use(auth());
-app.use(proxyToNpm());
+//app.use(proxyToNpm());
app.use(notFound);

if (config.enableCompress) {
diff --git a/cnpmjs.org/view/web/footer.html b/cnpmjs.org/view/web/footer.html
index e7a0f04..d432a6d 100644
--- a/cnpmjs.org/view/web/footer.html
+++ b/cnpmjs.org/view/web/footer.html
@@ -1,5 +1,4 @@
-Copyright 2013 - 2016 &copy; cnpmjs.org
+Copyright 2013 - 2018 &copy; cnpmjs.org
|
<a href="/">Home</a>
|
-<script>var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_5757157'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s17.cnzz.com/stat.php%3Fid%3D5757157%26online%3D1%26show%3Dline' type='text/javascript'%3E%3C/script%3E"));</script>

相关问题

阿里云无法通过ip:端口访问

ssh无法登录阿里云服务器

cnpm同步文件的存储位置在哪里

默认是在 $HOME/.cnpmjs.org/nfs 下面。具体看config配置
https://github.com/cnpm/cnpmjs.org/issues/635

失败 & 如何加入权限验证

https://github.com/cnpm/cnpmjs.org/issues/925

如何修改admin的密码?

  • https://github.com/cnpm/cnpmjs.org/issues/1050
  • https://github.com/cnpm/cnpmjs.org/issues/385

cnpm添加用户,以及admin用户如何publish

  • https://github.com/cnpm/cnpmjs.org/issues/431

项目脚手架

发表于 2018-03-25   |  

Vue

  • vue-cli
  • vue-template
  • poi

Node

  • https://github.com/yeoman/generator-node

综合资源

  • BOILRPLATE A curated directory of boilerplates to help you start your projects!
  • http://yeoman.io/generators/

小程序

参考

es6相关资源记录

发表于 2018-03-25   |  

本文收集整理es6相关的资源。

阅读全文 »

碰到的问题简单记录

发表于 2018-03-14   |  

对碰到的问题做个简单的记录,方便后期汇总整理。大部分答案来源于互联网,感谢默默奉献的人,有些没有及时注明出处,后期就找不到相关的文章了,😓😓

git 如何推送tag

1
2
3
4
# 推送全部tag
$ git push origin --tags
# 推送指定tag
$ git push tag 0.0.1
  • http://yijiebuyi.com/blog/007269d04d5096d9397ce3daf9d84c48.html
  • http://blog.csdn.net/shines/article/details/8558293
  • http://80x86.io/post/how-to-push-and-delete-a-remote-git-tag

git设置远程origin

1
2
3
4
5
6
7
# 修改已有的origin
$ git remote set-url --delete https://github.com/CocoaPods/Specs.git
$ git remote set-url --add origin https://github.com/CocoaPods/Specs.git

# 空项目添加origin #
$ git remote add origin https://github.com/CocoaPods/Specs.git
$ git push -u origin master

tar压缩忽略指定目录

Mac下--exclude需要写在前面

1
$ tar -czvf /Users/huixisheng/Desktop/j-excel.tar.gz --exclude j-excel/node_modules j-excel/

Nodejs守护进程

1
nohup node index.js > error.log 2>&1 &
1
2
3
nohup: redirecting stderr to stdout

$ > error.log 2>&1 &
  • http://blog.csdn.net/iechenyb/article/details/76270595

centos7安装nodejs8.x

直接安装过Node6.x,需要在机器上部署yapi。需要升级Node。

1
2
3
4
5
6
7
# 这个是否需要不确定
$ yum clean all
$ curl -sL https://rpm.nodesource.com/setup_8.x | bash -
# 安装不了,需要卸载重新安装
$ yum install -y nodejs
$ yum erase nodejs npm -y
$ yum install -y nodejs

更新日志

参考

无密码登录远程服务器

发表于 2018-02-09   |  

每次ssh连接都要输入密码,真的很麻烦。

[ykq@10-10-215-141 .ssh]$ ll
total 8
-rw-r–r– 1 ykq root 417 Aug 21 21:29 authorized_keys
-rw-r–r– 1 ykq root 1987 Feb 9 11:25 known_hosts

20 vi /etc/ssh/ssh_config
21 vi /etc/ssh/sshd_config
22 sudo chmod 755 ~/webpack-mhome.json
23 sudo chmod 777 ~/webpack-mhome.json
24 vi /etc/ssh/sshd_config
25 sudo vi /etc/ssh/sshd_config
26 sudo service ssh restart
27 which ssh
28 sudo chown ykq ~/webpack-mhome.json
29 sudo chown a+x ~/webpack-mhome.json
30 sudo vi /etc/ssh/sshd_config

PasswordAuthentication yes

➜ ssh-copy-id -i ~/.ssh/motian-server.pub root@xx.xx
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/Users/huixisheng/.ssh/motian-server.pub”
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keys
root@xx.xx‘s password:
/etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

Number of key(s) added: 1

Now try logging into the machine, with: “ssh 'root@xx.com‘“
and check to make sure that only the key(s) you wanted were added.

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

更新日志

ssh-keygen -t rsa -f ~/.ssh/github -C "email

ssh-add ~/.ssh/github

http://www.html-js.com/article/2379

sudo vim /etc/ssh/sshd_config
PubkeyAuthentication yes

PasswordAuthentication yes

Redirecting to /bin/systemctl restart ssh.service
Failed to restart ssh.service: Unit not found.

centos7下重启sshd服务的操作方法
在centos7下重启服务不再是 service 服务名称 动作 这样的方式的.而是:

systemctl 动作 服务名.service

  1. 查看sshd服务是否启动了.

systemctl status sshd.service

看到的这样的信息就可以确定是启动了.

  1. 如果没有启动,则需要启动该服务:

systemctl start sshd.service

  1. 如果需要重启sshd服务可使得

systemctl restart sshd.service

  1. 设置为开机启动可使用:

systemctl enable sshd.service

  • http://www.cnblogs.com/prettyisshit/p/5584558.html
  • http://www.cnblogs.com/lovlos/p/6596796.html

参考

  • http://www.ruanyifeng.com/blog/2011/12/ssh_remote_login.html
  • https://www.w3ctech.com/topic/1602
  • https://segmentfault.com/a/1190000008479071
  • https://stackoverflow.com/questions/19777357/getting-permission-denied-for-scp-over-ssh-server-to-local
  • http://www.worldhello.net/2010/04/08/1026.html
  • https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
  • https://gist.github.com/jexchan/2351996
  • https://help.github.com/articles/using-ssh-over-the-https-port/
  • http://blog.csdn.net/u012865381/article/details/78521087
  • https://help.aliyun.com/knowledge_detail/41487.html
  • http://blog.csdn.net/u013240609/article/details/78540795

用mac终端命令登录阿里云服务器,出现错误提示Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
http://blog.csdn.net/gigijingjing/article/details/76726564

Uncaught SyntaxError: Use of const in strict mode. 报错解决方法记录

发表于 2018-02-07   |  

项目中用vue,vue-router实现的页面在该设备下"Mozilla/5.0 (Linux; Android 5.1.1; YQ601 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36,Cosmeapp/9.1.0"空白。其他现有设备是正常的。想到可以连接真机设备进行调试,根据报错定位到相关的代码有问题,还是资源加载异常(比如cdn的资源在某些环境下异常)。然而连接usb无发审查元素。于是跑源码在本地环境下进行局域调试,结果页面也是空白。在页面注入weinre。有报错,但是不要定位,只是显示了报错。这里不得不吐槽下weinre确实不怎么好用。有看到过资料安卓的真机调试是需要客户端支持的。

Uncaught SyntaxError: Use of const in strict mode.

node_modules/_strip-ansi@4.0.0@strip-ansi/index.js

// ‘use strict’;
// var ansiRegex = require(‘ansi-regex’);

// module.exports = input => typeof input === ‘string’ ? input.replace(ansiRegex(), ‘’) : input;

‘use strict’;
var ansiRegex = require(‘ansi-regex’)();

module.exports = function (str) {
return typeof str === ‘string’ ? str.replace(ansiRegex, ‘’) : str;
};

// node_modules/_ansi-regex@3.0.0@ansi-regex/index.js

‘use strict’;

module.exports = function() {
// const -> var
var pattern = [
‘[\u001B\u009B][\#;?](?:(?:(?:[a-zA-Z\d](?:;[a-zA-Z\d]))?\u0007)’,
‘(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PRZcf-ntqry=><~]))’
].join(‘|’);

return new RegExp(pattern, 'g');

};

参考

  • https://github.com/mrdulin/blog/issues/35
  • https://stackoverflow.com/questions/36789889/syntaxerror-use-of-const-in-strict-mode
  • http://www.mind-geek.net/javascript/syntaxerror-use-of-const-in-strict-mode/
  • https://segmentfault.com/q/1010000007415253
  • 移动端真机调试指南 https://aotu.io/notes/2017/02/24/Mobile-debug/index.html

前端静态资源CDN公共库整理

发表于 2017-12-02   |  

开放的CDN最好是速度快,库全,支持快速检索。本文将列举国内外常用的前端静态资源CDN公共库。用开发的CDN写写demo,体验新框架的语法,但是用到生成环境,还需谨慎。虽然方便,但是万一库挂了,被人恶意注意代码,用多了影响还是很大。

阅读全文 »
123
huixisheng

huixisheng

前端路漫漫兮,吾将上下而求索

50 日志
60 标签
RSS
GitHub Twitter 微博
© 2019 huixisheng
由 Hexo 强力驱动
主题 - NexT.Pisces