Lecture 2_Shell Tools and Scripting
Overview 本视频(Missing Semester 课程的第二讲)的核心论题是,Shell(特别是 Bash)远不止是一个简单的命令执行器,它本身就是一个功能完备且异常强大的编程环境。讲座的结论是,通过掌握 Shell 脚本的核心概念(如变量、控制流、函数)以及学会使用一系列高效的命令行工具(用于查找、搜索和导航),开发者可以将大量重复性的手动任务自动化,从而极大地提升工作效率和能力。 按照主题来梳理 第一节:Shell 脚本编程——释放 Bash 的真正力量 大多数开发者将 Shell 视为执行单个命令的地方,但它的真正潜力在于其“脚本”能力。本节深入探讨了将 Shell (Bash) 作为一种编程语言来使用的核心概念,这是实现自动化的基石。 变量(Variables) 在 Bash 中定义变量非常直接,使用 foo=bar 这样的语法 [01:07]。但这里有一个至关重要的“怪癖”:等号两边绝对不能有空格。 foo = bar [01:33](注意空格)在 Bash 中不会被解释为变量赋值。相反,Shell 会尝试执行一个名为 foo 的程序,并将其...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick Start Create a new post 1$ hexo new "My New Post" More info: Writing Run server 1$ hexo server More info: Server Generate static files 1$ hexo generate More info: Generating Deploy to remote sites 1$ hexo deploy More info: Deployment
Hexo博客
我推荐的、也是目前最主流的组合是:Hexo + GitHub Pages。 Hexo:一个基于 Node.js 的静态博客框架。它非常受中文社区欢迎,主题(皮肤)超级多,文档也全,你写 Markdown 非常方便。 GitHub Pages:GitHub 提供的免费静态网页托管服务。 详细步骤:从零开始搭建 Hexo + GitHub Pages 博客 你只需要跟着这几步走,就能搭建完成。 第 1 步:准备工作(安装必备软件) 在开始之前,你的电脑上需要有 Git 和 Node.js。 安装 Git: 访问 Git 官网 下载并安装。 安装后,打开你的终端(Windows 叫 “CMD” 或 “PowerShell”,Mac/Linux 叫 “Terminal”),输入 git --version,能看到版本号就说明装好了。 安装 Node.js: 访问 Node.js 官网,下载 “LTS” (长期支持) 版本并安装。 安装后,在终端输入 node -v 和 npm -v,能看到版本号就说明装好了。 第 2 步:在 GitHub 上...
Lecture 3
Print and None 1. 概述 (Overview) 本视频的核心论题在于辨析 Python 中“表达式求值”和“print() 函数调用”之间的根本区别。虽然两者在交互式环境中可能展现出相似的输出,但其底层的机制截然不同。视频通过对比不同类型的值(数字、字符串,尤其是特殊值 None)的两种输出行为,揭示了 print() 的本质:它是一个“非纯函数 (Non-Pure Function)”。它的主要功能是产生“副作用 (Side Effect)”(即将内容显示到屏幕),而它本身的“返回值 (Return Value)”永远是 None。视频最终通过一个嵌套 print() 调用的复杂案例,清晰地展示了理解这一区别对于掌握 Python 执行流程和调试代码至关重要。 2. 按照主题来梳理 主题一:print 与“自动显示”—— 看似相同,实则不同 在 Python 的交互式解释器(Interactive Interpreter)中,当我们输入一个表达式(如数字 -2)并按回车时,解释器会自动显示该表达式的值 [00:09]。然而,如果我们使用 print(-2...
Lecture 2
Defining Functions Function definition is a more powerful means of abstraction: binds names to expressions format 12def <name>(<formal parameters>): return <return expression> Q&A Overview 这篇“文章”源于一场关于编程入门课程(61A)第二讲的问答(Q&A)。其核心论题与结论是:为了精确理解和预测 Python 代码(尤其是包含函数调用的复杂代码)的行为,你必须掌握一套机械化的心智模型,即“环境图” (Environment Diagrams)。这场讨论的核心在于辨析两个关键概念:“Frame”(帧),即一个独立的、用于追踪特定作用域内变量名绑定的“盒子”;以及 “Environment”(环境),即一个由当前帧及其所有父帧组成的、决定了变量查找顺序的“帧序列”。掌握这一模型,是从“猜测”代码意图转向“精确”理解代码执行的根本转变。 ...
Vim
Missing Semester Modal editing Vim is a modal editor. Normal: for moving around a files and making edits Insert: for inserting text Command-line: for running a command Replace: for replacing text Visual(plain, line or block): for selecting blocks of text Keystrokes have different meanings in different operating modes. e.g. x: In Insert mode will just insert a literal character ‘x’, but in Normal mode, it will delete the character under the cursor, and in Visual mode, it will delete the se...
Vim
Missing Semester Modal editing Vim is a modal editor. Normal: for moving around a files and making edits Insert: for inserting text Command-line: for running a command Replace: for replacing text Visual(plain, line or block): for selecting blocks of text Keystrokes have different meanings in different operating modes. e.g. x: In Insert mode will just insert a literal character ‘x’, but in Normal mode, it will delete the character under the cursor, and in Visual mode, it will delete the se...
搞笑
本人搭上了 00 后的车,来到了这个所谓的 21 世纪。 网络时代的爬虫,熟悉 Z -blog、Discuz、PHPwind、WordPress 等开源程序; 擅长 Ai、Fw、Fl、Br、Ae、Pr、Id、PS 等软件的安装与卸载; 精通 CSS、JavaScript、PHP、C、C++、C#、Java、Ruby、Perl、Lisp、Python、Objective-C、ActionScript 等单词的拼写; 熟悉 Windows、Linux、Mac、Android、IOS 等系统的开关机; 是中科院李子青实验室,王金桥实验室,陈熙林实验室,赫然实验室,程健实验室,清华鲁继文实验室,北大王勇涛实验室培养的学子的同国国友; 更是爱奇艺、优酷、腾讯、拼多多、饿了么、美团等多家平台 VIP 会员,其实我也想低调,但实力不允许啊~
macOS之终端
查询局域网 IP 1ipconfig getifaddr en0 en0在现代 Mac 上通常代表 WiFi 接口 en1即有线 1ifconfig 该命令会列出所有的网络接口(包括WiFi,蓝牙,虚拟接口等)的详细信息 查询公网 IP 12345curl ifconfig.mecurl icanhazip.comcurl ipinfo.io/ip 任选其一
The Art of Command Line
🌍 Čeština ∙ Deutsch ∙ Ελληνικά ∙ English ∙ Español ∙ Français ∙ Indonesia ∙ Italiano ∙ 日本語 ∙ 한국어 ∙ polski ∙ Português ∙ Română ∙ Русский ∙ Slovenščina ∙ Українська ∙ 简体中文 ∙ 繁體中文 The Art of Command Line Note: I’m planning to revise this and looking for a new co-author to help with expanding this into a more comprehensive guide. While it’s very popular, it could be broader and a bit deeper. If you like to write and are close to being an expert on this material and willing to consider helping,...