ding-fan / blog Goto Github PK
View Code? Open in Web Editor NEWPowered by Github.
Powered by Github.
官网教程和白话文教程已经写的很详细了,所以我写的是补充包。:smile:
可以用到的资源:
建议从自己不了解的供应商购买服务器时,先月付看看情况。可以去 telegram 群组或频道找找靠谱的供应商。
注意:我的本地系统是 macOS ,VPS 系统选择的是 Debian 9 。
可以用到的资源:
我是按照白话文教程来配的。建议按照白话文教程来配,遇到问题可以从官网或本文找到答案。
注意:输入 一连串的命令
的意思,就是在 terminal 输入 一连串的命令
然后敲回车
ssh 用户名@服务器地址
,将 用户名
替换为你的远程服务器的用户名,通常是 root
,将 服务器地址
替换为你的远程服务器的 IP address ( IP 地址)[email protected]'s password:
输入你的远程服务器的登录密码即可(不知道密码?在哪儿买的就去哪儿找啊!通常是找 root password ( root 密码)。注意:输入的密码是不可见的。
你已经进入你的远程服务器了
如果怎么都登不进去,建议重装远程服务器
可以用到的资源:
时间校准:
在你的远程服务器中
cd /usr/share/zoneinfo/Asia
再输入 ls
是不是看到很多东西?其中有一个叫 Shanghai
的,我们会用到它。什么,你没有看见 Shanghai
?呃,那这一节对你没用了,去 Google 一下该怎么办吧。什么,打不开 Google ?那用其他的搜索引擎吧,尽量别用百度。cd /etc
再输入 ls
是不是看到很多东西?其中有一个叫 localtime
的,我们准备搞它。rm /etc/localtime
再输入 ls
你会发现 localtime
不见了。ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
再输入 ls
你会发现 localtime
又出现了。如果你遇到 SSH 连接自动断开的情况,看这里:
打开一个新的终端(在 mac 上,command + t 可以打开新的标签页)
cd /etc/ssh
再输入 ls
是不是看到很多东西?其中有一个叫 ssh_config
的,我们准备搞它。ServerAliveInterval 60
就好了。或者,可以从 Finder 找到这个文件用自带编辑器操作,加上 ServerAliveInterval 60
就好了。加上之后是这样的:
在你的远程服务器中
cd /etc/v2ray
再输入 ls
是不是看到……一个东西?config.json
,就是它了一个简单的 vi 介绍:
输入 vi config.json
你现在进入了 normal 模式,不要乱敲键盘!如果你已经乱敲键盘了,这里有解药:esc + : + q + ! ,敲下回车即可。
你可以使用方向键移动光标。想体验一下 vi 的魅力?可以用 h j k l
(分别对应 左 下 上 右)移动光标。
把光标移动到需要修改的地方,按一下 i 进入 insert 模式。现在可以进行修改了。键盘上的字母键、数字键、方向键、删除键都按你想像的那样工作。
基本上需要修改的就是这两个地方
port (端口)可以保持不变,可以自由修改。比如 666 什么的。
id 可以保持不变,可以自由修改。打开这里可以获得一个 id ,填上去就好了。
修改好了怎么保存?esc + : + w + q ,敲下回车即可。
官网教程有讲的!你看
bash install-releash.sh
差不多就这些了,拥抱自由吧。
刷 codewars 时遇到这样一题:
给你一个正整数,例如 987654321
,你需要进行这样的计算
9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 = 45
4 + 5 = 9
最后的到的结果就是 9
。要求写一个函数来完成这样的计算。
看到这题,我的想法是(我使用 ruby ):
string
,用 .each_char
取出每一个 char
并转为数字,求和。.to_s
转换为 string
,然后判断 .length
是否等于 1
。很简单嘛!老夫抄起键盘就是一把梭。
def digital_root(n)
if n.to_s.length == 1
return n
else
sum = 0
n.to_s.each_char do |char|
sum += char.to_i
end
digital_root(sum)
end
end
写的时候想起之前见过的递归,很得意的用上了。提交答案时运行了 0.6 秒,不知道是不是这个原因……
提交之后看了看别人的答案,震惊。原来不需要把 n
转成 string
再判断长度,直接判断是否 n < 10 就可以了。
就这也叫震惊?当然不止。看这个只有一行的答案吧:
def digital_root(n)
n < 10 ? n : digital_root(n / 10 + n % 10)
end
讲真,到现在我还没看懂。正在查资料呢。
确定需求,确定后端接口字段,确定前端显示页面字段。
写 route 时,把 login 页面单独作为一个 component Login ,把剩下部分统一放在 component Layout 中,以 children 的形式配置 route 。这样可以把登录部分和其它部分完全分开。
在 login 页面,调用 login 接口后把 token 写入 cookie 并附上 expire time 。
给 axios 设置 interceptor ,每次发送请求时把 token 从 cookie 中取出放入 request header 中。
可选:把页面 loading 状态显示的插件放在 interceptor 中,每次调用接口的等待时间会显示 loading 插件
根据后端 create read update delete 接口制定 model 层面的数据类型与结构。
根据(各)页面显示字段制定 view 层面的数据类型与结构。
确定主要操作流程的数据显示逻辑(即接口调用顺序)。例如:read -> create -> read , read -> update -> read , read -> delete -> read 这样。
将数据初始化写成一个 method ,这样在 reset 的时候也可以用。
选取典型页面(例如列表显示、新增表单),写业务逻辑部分,即 controller 层面。然后将通用方法例如数据校验( validator )模块,model 层与 view 层的数据互相转换模块,特殊功能部分例如图片上传模块,单独放在 mixins 文件夹下,需要时以 mixin 形式引入。
将后端提供的 api 按模块划分为不同 js 文件放在 src/api/ ,用例如 export { getHaHaHa, postHaHaHa, deleteHaHaHa } 的形式提供出来。
待续。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.