会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
箫笛
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
11
12
13
14
15
16
17
18
19
···
24
下一页
2022年3月21日
shell编程 - sed编辑器
摘要: 1. sed命令格式 sed options script file cat test.txt # 输出test.txt内容 this is test 1 this is test 2 this is test 3 sed 's/test/Test/' test.txt # 将test.txt中所有
阅读全文
posted @ 2022-03-21 13:04 箫笛
阅读(136)
评论(0)
推荐(0)
2022年3月20日
shell编程 - 三元表达式
摘要: 1.字符串操作符实现 str="" str1="default" str2=${str:-$str1} echo $str2 # default 2. 条件测试实现 str="" str1="default" str2=$([ -z "$str" ] && echo "$str1" || echo
阅读全文
posted @ 2022-03-20 13:56 箫笛
阅读(502)
评论(0)
推荐(0)
shell编程 - 字符串
摘要: 1. 获取字符串长度 str="test" echo ${#str} 2. 获取匹配的子串的长度 str="substring" echo $(expr match "$str" "*.b") 3. 获取子串的索引 str="substring" echo $(expr index "$str" "
阅读全文
posted @ 2022-03-20 12:11 箫笛
阅读(68)
评论(0)
推荐(0)
shell编程 - 字典
摘要: 1.声明字典 declare -A dic 2. 初始化字典 dic=( ["key1"]="value1" ["key2"]="value2" ["key3"]="value3" ) 3. 获取字典的值 value=${dic["key3"]} // 获取某个键的值 values=${dic[*]
阅读全文
posted @ 2022-03-20 09:57 箫笛
阅读(2976)
评论(0)
推荐(0)
2022年3月5日
Raspbian - 基于树莓派4配置SSH服务
摘要: 1. 在服务器端启用ssh服务 sudo /etc/init.d/ssh start 在服务端启用ssh服务 sudo update-rc.d ssh enable 将ssh服务设为开机自启动 2. 配置服务器ip为静态ip sudo vim /etc/dhcpcd.conf interface w
阅读全文
posted @ 2022-03-05 12:21 箫笛
阅读(213)
评论(0)
推荐(0)
2022年2月25日
Raspbian - 基于macOS烧录树莓派4系统
摘要: 1. 格式化sd卡 利用macOS自带的磁盘工具格式化sd卡 访达-前往-实用工具-磁盘工具 点击sd卡对应的磁盘,并点击抹掉,格式选择MS-DOS(FAT) 2. 烧录镜像 利用df -h 查看sd卡挂载的卷,比如/dev/disk4s2 卸载sd卡挂载的分区,diskutil unmount /
阅读全文
posted @ 2022-02-25 18:38 箫笛
阅读(831)
评论(0)
推荐(0)
2022年2月21日
vim 使用缩略词
摘要: 使用abbreviations可以进行单词的拼写纠错,但用它进行代码的替换可以极大的提高编程效率 在.vimrc配置文件中自定义abbreviations 1. 纠正拼写错误 iabbrev adn and 输入adn时则自动纠正为and 2. 插入代码片段 iabbrev _fn () => {<
阅读全文
posted @ 2022-02-21 16:04 箫笛
阅读(103)
评论(0)
推荐(0)
Express - 使用模版渲染
摘要: Express可以使用jade, ejs作为模版引擎进行模版渲染,默认是jade,使用ejs作为模版引擎需要进行设置 1. 使用ejs模版 安装ejs模块 npm install ejs --save 设置ejs模版 // 设置模版文件目录 app.set('views', './templates
阅读全文
posted @ 2022-02-21 16:01 箫笛
阅读(189)
评论(0)
推荐(0)
Express - 使用错误处理
摘要: 1. 同步错误 app.get('/', (req, resp) => { if(!req.query.name) { throw new Error('name query parameter required'); } resp.end('ok'); }); 2. 异步错误 异步错误,发生在回调
阅读全文
posted @ 2022-02-21 14:55 箫笛
阅读(505)
评论(0)
推荐(0)
2022年2月20日
Express - 使用响应对象
摘要: 每个路由函数或中间件都接收一个response响应对象,路由函数通过调用响应对象的方法,可以将响应发送到客户端,并结束请求处理。 如果路由函数未调用响应对象的任何方法,则客户端请求将被挂起,直到客户端超时。 1. 设置响应状态码 resp.status(statusCode) app.get('/'
阅读全文
posted @ 2022-02-20 21:44 箫笛
阅读(151)
评论(0)
推荐(0)
上一页
1
···
11
12
13
14
15
16
17
18
19
···
24
下一页
公告