Code snippets to configure Windows
This post records some useful code snippets derived from my Windows configuration. These snippets are designed to achieve certain targets/goals/purposes, such as disable auto reboot after updates, enable long paths, etc. Disable auto reboot after updates Refer to Manage device restarts after updates - Windows Deployment | Microsoft Learn. Manage windows device restarts after updates, make it: Automatically download and schedule installation of updates. Don’t reboot after an update...
Analyses of round function
This article does a mathematical abstraction of the rounding-to-integer function \(round(\cdot):\mathbb{R}\rightarrow \mathbb{Z}\), and gives out some analyses of some cases. These analyses’ results will help in the derivations of some algorithms. Later, more cases and analyses may also be added here. Introduction Rounding or rounding off means replacing a number with an approximate value that has a shorter, simpler, or more explicit representation. For example, replacing \(23.4476\)...
德·摩根定律证明过程
本文是对《概率导论(第2版·修订版)》1 中德·摩根定律 的证明过程的记录与补充完整。 证明与补充 德·摩根定律: \[ \begin{equation}\label{eq1}\tag{1} (\bigcup_nS_n)^c=\bigcap_nS_n^c \end{equation} \] \[ \begin{equation}\label{eq2}\tag{2} (\bigcup_nS_n)^c=\bigcap_nS_n^c \end{equation} \] 证明 \(\eqref{eq1}\): 设 \(x\in(\bigcup_nS_n)^c\) 这说明 \(x\notin \bigcup_nS_n\) 即对一切\(n\) , \(x\notin S_n\) 因而,对每一个 \(n\) , \(x\) 属于 \(S_n\)的补集,即 \(x\in \bigcap_nS^c_n\) 可以得到 \((\bigcup_nS_n)^c\subset \bigcap_nS_n^c\) 将上述1,2,3,4证明从后往前: 设...
Install TensorFlow(GPU) on WSL2
This article introduces my solutions/methods of installing and using TensorFlow(GPU)(2.6.1), with keras(3.0.5) on WSL2. My specific environment is: WSL2: 2.0.14.0 WSL2's Linux system: Ubuntu22.04 PowerShell: 7.4.1 Conda: 24.1.2 Cuda: 12.4.0 Cudnn: 8.9.7.29 Python: 3.12.2 TensorFlow: 2.16.1 Keras: 3.0.5 Motivation It seemed very easy and smooth to install TensorFlow(GPU) on WSL2 in the last few years, when WSL2 started to support CUDA. But recently, the installation and usage may bring...
【PowerShell模组开发日志】简单重置`SDDL`以解决ReFS或者NTFS中的授权问题
作为Windows用户,会经常涉及两个实现了高级安全功能的文件系统,ReFS和NTFS,但也给普通用户带来了和授权有关的使用问题。例如,“重装系统后,新系统用户没有对旧系统用户文件/文件夹的授权”。更具体地,当用户重装了Windows系统,但是选择保留文件时,未格式化的磁盘上的旧系统用户文件夹,依旧保留着对旧用户的授权,而没有对新系统用户开放授权(即使以同一个微软账号登录,也会视为一个新的用户)。这就是一种用户侧感知到的授权问题。 一般地,新用户需要手动给与授权,以便于获取旧用户文件夹中的内容。如果这个过程可以以一定的标准自动执行,将极大地方便重装系统但是保留文件的用户。在实践中,我们发现,如果能够简单地重置目标对象的 SDDL,就可以在不甚了解计算机安全这个大议题的情况下,让和作者本人一样的纯小白用户也能理解并解决其遇到的授权问题。这就是本文的核心动机。后文将简单地介绍 SDDL,给出借助PowerShell模组...
【PowerShell模组开发日志】环境变量路径`$Env:Path`的简单管理(添加、删除、去重)
本文是PowerShell模组 PSComputerManagementZp 的使用案例分享。记录了通过该自定义模组,管理多个层级$Env:Path的过程。包括添加、删除、去重等。本文的案例非常适合于使用PowerShell进行系统管理,工具调用等行为的场景。 基本概念与动机 环境变量:环境变量是一个动态命名的值,可以影响计算机上进程的行为方式。例如一个正在运行的进程可以查询TEMP环境变量的值,以发现一个合适的位置来存储临时文件,或者查询HOME或USERPROFILE变量,以找到运行该进程的用户所拥有的目录结构。 $Env:Path: PATH是类Unix系统、DOS、OS/2和Microsoft Windows操作系统上的一个环境变量,用于设置一组包含可执行文件的目录。 在所有的环境变量中,我们关心的最多的,一般就是$Env:Path,因为其涉及诸多软件工具之间的相互配合与调用流程。当我们使用PowerShell等命令工具(或者说是shell)还安装使用 Miniconda, MSYS2 等带有包管理器,实现独立的包管理模式 的工具时,$Env:Path...
【PowerShell模组开发日志】Windows DDNS, 将本机IPv6推送到阿里云DNS
本文是PowerShell模组 PSComputerManagementZp 的使用案例分享。记录了借助 aliyun-cli 工具在Windows上配置DDNS,将本机IPv6推送到阿里云解析的过程。 基本概念与动机 DNS(Domain Name System): DNS 是域名系统的缩写,它是一种用于将易于记忆的域名(比如 www.example.com)映射到计算机网络中的 IP 地址的系统。DNS 提供了一种分布式数据库,允许将域名转换为与之相关联的 IP 地址。通过使用域名而不是直接使用 IP 地址,用户可以更轻松地访问互联网上的资源。 DDNS(Dynamic Domain Name System): DDNS 是动态域名系统的缩写。与传统的静态 DNS 不同,DDNS 允许动态地更新域名与 IP 地址之间的映射。这对于拥有动态 IP 地址的设备非常有用,例如家庭网络中的路由器。DDNS 允许设备在其 IP 地址更改时自动更新与其关联的域名,确保用户可以始终通过域名访问设备而不受 IP...
How to compile TensorFlow-GPU both on Linux (WSL2) and Window
This article record some key procedures for me to compile TensorFlow-GPU on Linux (WSL2) and on Windows. Because of the convenience of MiniConda, we can abstract the compiling process into a number of steps that are almost independent of the operating system (platform). Therefore, this article is not a rehash of the official or third-party compiling process available online, but a new integration basing on Conda tools, getting rid of those tedious and annoying steps in those tutorials and...
Discuss the mathematics of apportionment when splitting the machine learning dataset into several parts by proportions
This article discusses an operation that originated in machine learning, i.e., when splitting a dataset with the same genre of elements by a series of proportions, how to determine the element’s total number of each divided group, focusing on dealing with decimal rounding problems. Initially, this operation was not a theoretical problem, but a simple engineering problem for programming implementation. However, we performed further thoughts and analysis, refined this operation into...
Passing and verification of parameters in Python
This article records some useful tips and examples for me to using PyYAML for configuration, i.e., passing parameters and verifying parameters for a Python project. The official tutorials can be find here. Precedent Concepts and Analysis In Python, there are several methods to pass parameters to your project: Command-line arguments: Such as use built-in module argparse: 1python main.py --input input.txt --output output.txt In python: 12345678910# main.pyimport argparseparser =...