西维蜀黍

【Linux】Aquantia AQC107 网卡驱动安装

# Make sure you have all the packages required to build a standalone kernel module.
sudo apt install build-essential
sudo apt-get install linux-headers-`uname -r`

# Untar/unzip archive:

cd Aquantia-AQtion-x.y.z/

# Compile the driver module:
$ make

# Load the dependencies and the module itself:
$ sudo make load
	
# Unload the driver, if an older version is in use:
# $ sudo rmmod atlantic
	
# Load the module: 
$ sudo insmod atlantic.ko

# Install the driver
$ sudo make install

# check your kernel version
$ uname -r
5.8.0-50-generic

# Install the driver in the system
$ sudo make && sudo make install

Leaving directory '/usr/src/linux-headers-5.8.0-50-generic'
  ...


【Hackintosh】AMD Ryzen Hackintosh 安装 Docker

Error

  ...


【Ubuntu】安装 AMD Radeon 显卡驱动

Download

Download from https://www.amd.com/en/support/graphics/amd-radeon-6000-series/amd-radeon-6800-series/amd-radeon-rx-6800-xt

$ tar -xJvf amdgpu-pro_*.tar.xz
  ...


【Docker】Alpine Linux 软件管理

Update the Package list

# Update the Package list
$ apk update
  ...


【Linux】搭建 DHCP 服务器

Installing DHCP Server

Before proceeding towards installing a DHCP server, first update the packages by running the following command in Terminal:

$ sudo apt-get update

Then run the following command in the Terminal to install DCHP server:

$ sudo apt-get install isc-dhcp-server -y
  ...


【macOS】制作 macOS 安装 U 盘

Refer to https://dortania.github.io/OpenCore-Install-Guide/installer-guide/mac-install.html

下载镜像

Approach 1 - Munki’s InstallInstallMacOS utility

In order to run it, just copy and paste the below command in a terminal window:

mkdir -p ~/macOS-installer && cd ~/macOS-installer && curl https://raw.githubusercontent.com/munki/macadmin-scripts/main/installinstallmacos.py > installinstallmacos.py && sudo python installinstallmacos.py

As you can see, we get a nice list of macOS installers. If you need a particular versions of macOS, you can select it by typing the number next to it. For this example we’ll choose 10:

This is going to take a while as we’re downloading the entire 8GB+ macOS installer, so it’s highly recommended to read the rest of the guide while you wait.

Once finished, you’ll find in your ~/macOS-Installer/ folder a DMG containing the macOS Installer, called Install_macOS_11.1-20C69.dmg for example. Mount it and you’ll find the installer application.

  • Note: We recommend to move the Install macOS.app into the /Applications folder, as we’ll be executing commands from there.
  • Note 2: Running Cmd+Shift+G in Finder will allow you to easily jump to ~/macOS-installer

Approach 2 -Command Line Software Update Utility

Open a terminal window then copy and paste the below command:

softwareupdate --list-full-installers;echo;echo "Please enter version number you wish to download:";read;$(if [ -n "$REPLY" ]; then; echo "softwareupdate --fetch-full-installer --full-installer-version "$REPLY; fi);

  ...


【Golang】使用 - 执行shell命令

执行命令并获得输出结果

最简单的例子就是运行ls -lah并获得组合在一起的stdout/stderr输出。

func main() {
	cmd := exec.Command("ls", "-lah")
	out, err := cmd.CombinedOutput()
	if err != nil {
		log.Fatalf("cmd.Run() failed with %s\n", err)
	}
	fmt.Printf("combined out:\n%s\n", string(out))
}
  ...


【Golang】package - os/exec

func Command(name string, arg ...string) *Cmd

func Command(name string, arg ...string) *Cmd

Command returns the Cmd struct to execute the named program with the given arguments.

It sets only the Path and Args in the returned structure.

If name contains no path separators, Command uses LookPath to resolve name to a complete path if possible. Otherwise it uses name directly as Path.

The returned Cmd’s Args field is constructed from the command name followed by the elements of arg, so arg should not include the command name itself. For example, Command(“echo”, “hello”). Args[0] is always name, not the possibly resolved Path.

  ...


【Golang】使用 - 优雅重启/关闭进程

Graceful Exit

func Notify(c chan<- os.Signal, sig ...os.Signal)

Notify causes package signal to relay incoming signals to c. If no signals are provided, all incoming signals will be relayed to c. Otherwise, just the provided signals will.

Package signal will not block sending to c: the caller must ensure that c has sufficient buffer space to keep up with the expected signal rate. For a channel used for notification of just one signal value, a buffer of size 1 is sufficient.

It is allowed to call Notify multiple times with the same channel: each call expands the set of signals sent to that channel. The only way to remove signals from the set is to call Stop.

It is allowed to call Notify multiple times with different channels and the same signals: each channel receives copies of incoming signals independently.

  ...


【macOS】显示进程父进程

$ brew install pstree

  ...