linux XFS filesystem

Run the following commands, if your disk has been mounted, you need to unmount it first apt install xfsprogs mkfs.xfs /dev/sdb -L DISK1 Add the entry to /etc/fstab, then you don’t need to mount it again after each reboot: LABEL=DISK2 /mnt/disk2 xfs defaults,noatime 0 2

Linux auto remount after reboot

edit /etc/fstab add blow entry(only for ext): /dev/sdb1 /media/disk2 ext2 defaults 0 2 /dev/sdb1 device: /dev location or uuid. /media/disk2 mount point. ext2 file system type: get it from file -s /dev/sdb1 command. defaults options. 0 dump. 1 pass num. more detail refer to ubuntu Fstab

linux temperature monitor

CPU/GPU lm-sensors 可以监测cpu/gpu的温度 # install sudo sensors-detect # check temperature sensors 但是因为linux内核的更新速度,最新的cpu和gpu一般无法识别,也无法监测温度 这时候可以

Java parse CSV string

Library gradle: implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-csv") You don’t need to specify the version in normally spring boot project, because your parent dependency already has it. Code val schema = CsvSchema.emptySchema().withHeader() val mapper: ObjectReader = CsvMapper().readerFor(MyEntity::class.java).with(schema) mapper.readValues<MyEntity>(csvJson).readAll() In MyEntity, you don’t need any other annotations, just normal fasterxml annotations is enough: class MyEntity{ @JsonProperty("first_string") var firstString: String? = null @JsonProperty("second_string") var secondString: String? = null @JsonProperty("third_date") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai") var thirdDate: Date?

Cannot assign to property: 'self' is immutable

struct Test{ var param1 = false func method1() { param1 = true } } param1 = true will throw the exception Cannot assign to property: 'self' is immutable The reason is that struct is saved in stack memory, so its parameters cannot be modified. But we can change it through mutating: struct Test{ var param1 = false mutating func method1() { param1 = true } } Refer to stack overflow