主页

Wolfram 使用

安装 Wolfram Engine for Developers

Wolfram Engine for Developers 是 Wolfram Language 的后端核心,安装完成后可以使用 WolframScript 进入命令行执行代码。

安装 WolframLanguageForJupyter 插件

使用 Jupyter notebook 做为 Wolfram Engine 的前端

pip install jupyterlab

git clone https://github.com/WolframResearch/WolframLanguageForJupyter.git

./configure-jupyter.wls add

现在可以在 jupyter lab 中打开 Wolfram Language 的 Notebook。

阅读更多

SELinux 设置

关闭 SELinux

getenforce 命令检查 SELinux 是否已禁用,其结果为 EnforcingPermissiveDisabled 之一,修改 SELinux 配置文件可将其禁用。

sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

如果只想临时关闭 SELinux,可以输入命令

setenforce 0

阅读更多

为 Markdown 添加样式

使用 inline CSS style

在表格中使用颜色

<style>
    .mytable td:nth-child(1) { font-weight: bold; }
    .mytable tr:nth-child(1) td:nth-child(n+2):nth-child(-n+4) { background: red; }
    .mytable tr:nth-child(2) td:nth-child(2) { background: deepskyblue; }
    .mytable tr:nth-child(2) td:nth-child(3) { background: palegreen; }
    .mytable tr:nth-child(2) td:nth-child(4) { background: orange; }
</style>

|       | Column 1 | Column 2 | Column 3 |
| ----- | :------: | :------: | :------: |
| Row 1 |  R1 C1   |  R1 C2   |  R1 C3   |
| Row 2 |  R2 C1   |  R2 C2   |  R2 C3   |
{:.mytable}

阅读更多

macOS Tips

启动台无法切换页面

经常在拖动图标到不同页面的时候发现启动台切换页面失效,会自动切回到第一页,在终端使用下面的命令可以重启控制台

killall Dock

查看系统信息

所有系统信息

osascript -e "system info"

IP 地址

osascript -e "IPv4 address of (system info)"

通过命令行唤醒和睡眠系统

在充电状态下,macbook 睡眠后可以仍可以保持 ssh 链接,可以通过以下命令对 macbook 进行远程操作

阅读更多

重置 Win10 密码

  1. 使用优盘进入 WinPE 系统 (推荐优启通)

  2. 打开命令行程序

     C:
     cd C:\Windows\System32
     move Utilman.exe Utilman.exe.bak
     copy cmd.exe Utilman.exe
    
  3. 拔掉优盘重启系统

  4. 在登录界面点击屏幕右下角的 轻松使用 图标打开命令行工具

     cd C:\Windows\System32
     control userpasswords2
    
  5. 在弹出的对话框中可以重置用户密码。

阅读更多

macOS System Provision

使用恢复系统重新安装 macOS

重新启动 Mac,然后立即按住以下其中一个组合键

  • 安装与电脑兼容的 macOS 最新版本:按住 Option-Command-R
  • 重新安装电脑原始版本的 macOS(包括可用的更新):按住 Shift-Option-Command-R
  • 重新安装储存在电脑内建恢复宗卷中的 macOS 版本:按住 Command-R

阅读更多

Systemctl 命令

systemd-sysv-generator 工具

Unit 命令

列出当前内存中的 units

systemctl list-units

The LOAD column shows the load state, one of loaded, not-found, bad-setting, error, masked. The ACTIVE columns shows the general unit state, one of active, reloading, inactive, failed, activating, deactivating. The SUB column shows the unit-type-specific detailed state of the unit, possible values vary by unit type.

阅读更多

微积分 (Calculus)

微分

切线(tangent line)是数学中的一个基本概念,通常用于函数图形或几何图形,切线的基本定义:

  • 在几何学中,圆的切线被定义为与圆只有一个公共点(切点)的直线。这是切线最直观的定义,可以扩展到其他几何图形,比如椭圆或多边形。
  • 在微积分中,一条切线是曲线在某一特定点上的 直线近似。更严谨地说,若曲线为函数 $y = f(x)$,那么在点 $(a, f(a))$ 处的切线,设为 $y=L(x)$,是该点的唯一一条直线,其斜率(slope)等于函数在该点的导数 $f’(a)$。这条直线 $L(x)$ 与曲线 $f(x)$ 在 $x=a$ 处通过直线的斜率 $m$ 和曲线的导数 $f’(a)$ 联系在一起,换句话说,这条直线在点 $(a, f(a))$ 附近与函数 $y = f(x)$ 的图形非常接近,斜率 $m$ 为
\[m = f'(a) = \lim_{h \to 0} \frac{f(a+h) - f(a)}{h} = \lim_{\Delta x \to 0} \frac{\Delta y}{\Delta x}\]

给定斜率后,可以使用点斜式等式来描述这条直线:

\[y - f(a) = f'(a)(x - a)\]

切线的概念是分析和理解函数局部行为非常有用的工具,它是微积分中研究变化率和做线性近似的基础。

微分

这个线性函数 $L$ 被称为 $f$ 在 $x = a$ 处的 线性化。在上图中, 还有个量被标记了出来, 那就是 $\mathrm{d}f$, 也就是点 $P$ 和 $f(a)$ 的高度之差,可以通过在点 $a$ 处的斜率及 $x$ 的变化量得到

\[\boxed{\mathrm{d}f = f'(a)\Delta x}\]

量 $\mathrm{d}f$ 被称为 $f$ 在 $x=a$ 处的 微分。它是对当 $x$ 从 $a$ 变化为 $a+\Delta x$ 时 $f$ 的变化量的近似。

阅读更多

Cron

Cron 进程

RedHat/CentOS

service crond status

Ubuntu

service cron status

Cron 语法

# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │                                   7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * command to execute
# 每 30 分钟执行一次 logrotate
*/30 * * * * /usr/sbin/logrotate /etc/logrotate.d/nginx >/dev/null 2>&1

阅读更多

Perl

使用 Perl 手册页快速获得信息

Perl 手册页命令 perldoc。使用 perldoc perl 来获取所有 perldoc 支持的主题。

perldoc perl
perldoc perldoc
perldoc perlcheat

# 查看所有内置函数信息
perldoc perlfunc
# 快速查看某一内置函数信息
perldoc -f chomp

# 查看所有预定义变量信息
perldoc perlvar
# 快速查看某一预定义变量信息
perldoc -v '$_'

阅读更多

PostgreSQL

psql - PostgreSQL 交互式终端

PostgreSQL 交互式终端 psql 的使用,包括连接字符串,免密设置,元命令以及常见的 SQL 语句。

阅读更多