Friday, January 12, 2024

Reduce /home and Add SWAP space in Centos 9

dnf install xfsdump
dnf install xfsrestore

 umount /home

xfsdump -f home.bkup /dev/mapper/ol-home

lvchange -an /dev/ol/home

 lvremove /dev/ol/home

 lvcreate -L 30G -n home ol

mkfs.xfs /dev/ol/home

 mount -a

 df -h


 xfsrestore -f home.bkup /home

ls /home

   df -h

 lvcreate -L 4G -n swap ol

  mkswap /dev/ol/swap

  swapon /dev/ol/swap

  echo "/dev/ol/swap swap swap defaults 0 0" >> /etc/fstab

free


Monday, November 27, 2023

ACL in Linux

ACL in Linux

Set ACL

  setfacl -m user:clinton:rwx /testfolder

Verify ACL

 getfacl /testfolder

Remove ACL

setfacl -R -x u:cgao /testfolder

  getfacl /testfolder


Friday, November 24, 2023

Excel: Auto Fill a Column with a Specific Value

 Open Excel and click Automate in menu -> New Script, Customize below script and paste in the Code Editor:


```

function main(workbook: ExcelScript.Workbook) {
  // Get the active worksheet
  let ws = workbook.getActiveWorksheet();
  // Find the last row with data in column C
  let lastRowC = ws.getRange("C:C").getLastCell().getRowIndex();
  // Loop through all the rows
  for (let i = 1; i <= lastRowC; i++) {
    // Get the cells in column C and BP
    let cellC = ws.getCell(i, 2); // 2 is the correct column index for C
    let cellBP = ws.getCell(i, 67); // 67 is the correct column index for BP
    // Replace the value in column BP with the value in column C
    // cellBP.setValue(cellC.getValue())
    try {
      // Set the value in column BP to "Y202309"
      cellBP.setValue("2023-09");
    } catch (error) {
      console.error(`Error setting value in BP for row ${i}: ${error}`);
    };
  }
}
```

And click Run, then monitor if the column is updated.