Linux输入输出重定向

&>file 意思是把标准输出 和 标准错误输出 都重定向到文件file中 /dev/null是一个文件,这个文件比较特殊,所有传给它的东西它都丢弃掉 command > filename 把标准输出重定向到一个新文件中 command » filename 把标准输出重定向到一个文件中(追加) command 1 > fielname 把标准输出重定向到一个文件中(和 > 一样的) command > filename 2>&1 把标准输出和标准错误一起重定向到一个文件中 command 2 > filename 把标准错误重定向到一个文件中 command 2 » filename 把标准输出重定向到一个文件中(追加) command » filename 2>&1 把标准输出和标准错误一起重定向到一个文件中(追加) command < filename >filename2 把command命令以filename文件作为标准输入,以filename2文件作为标准输出 command < filename 把command命令以filename文件作为标准输入 command « delimiter 把从标准输入中读入,直至遇到delimiter分界符 command <&m 把文件描述符m作为标准输入 command >&m 把标准输出重定向到文件描述符m中 command <&- 把关闭标准输入 原文链接

2021-12-31 · 1 min · YC-Xiang

mac Homebrew和gem下载源修改

Homebrew下载源修改 https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/ export HOMEBREW_INSTALL_FROM_API=1 export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api" export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles" export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple" Gem下载源修改 # 移除gem默认源,改成ruby-china源 $ gem sources -r https://rubygems.org/ -a https://gems.ruby-china.com/ # 使用Gemfile和Bundle的项目,可以做下面修改,就不用修改Gemfile的source $ bundle config mirror.https://rubygems.org https://gems.ruby-china.com # 删除Bundle的一个镜像源 $ bundle config --delete 'mirror.https://rubygems.org'

2021-12-24 · 1 min · YC-Xiang

0 min

Lab >>> print('Go') Go HW Q1 A Plus Abs B python3 ok -q a_plus_abs_b --local def a_plus_abs_b(a, b): if b < 0: f = sub else: f = add return f(a, b) Q2 Two of Three python3 ok -q two_of_three --local 返回三个数中最小的两个数。先取 min(i, j)得到较小的一个数,在从 min(max(i, j), k)中得到第二小的数。 def two_of_three(i, j, k): return min(i, j)**2 + min(max(i, j), k)**2 Q3 Largest Factor python3 ok -q largest_factor --local 返回能被整除的最大数。从 1 到 n 遍历,如果 n%i==0 即能够整除,返回最大值。...

1 min

Lab Q1 Short Circuiting >>> True and 13 13 >>> False or 0 0 >>> not 10 False >>> print(3) or "" # 首先会打印3,再打印“” 3 "" Q2 High-order Function ...

1 min

VSCode 配置 python Lab00 python3 ok --help: 查看 ok 提示。 python3 ok -q <file> -u: 运行单个 tests 目录下的测试。 python3 ok -q <function>: 运行单个函数的测试。 python3 ok: 运行全部测试。 python3 ok --score:查看分数。 python3 ok --local:本地运行测试。 python3 -m doctest lab00.py: 运行 doctest。 python3 -i xxx.py: 进入 python 交互模式 python3 -m doctest xxx.py: 运行函数的 doctest,如下,会运行»>后的函数,并与 2024 对比。如果 pass 的话不会有任何输出。 def twenty_twenty_four(): """Come up with the most creative expression that evaluates to 2024 using only numbers and the +, *, and - operators....

1 min

book 看浮点数实现。 浮点数汇编。 lab data lab 继续做以及笔记。 bomb lab phase6和secret bomb。

1 min