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.


Wednesday, June 14, 2023

Error creating: admission webhook "namespace.sidecar-injector.istio.io" denied the request: failed to run injection template: template: inject:212:12: executing "inject" at <.EstimatedConcurrency>: can't evaluate field EstimatedConcurrency in type *inject.SidecarTemplateData

 Problem:

Error creating: admission webhook "namespace.sidecar-injector.istio.io" denied the request: failed to run injection template: template: inject:212:12: executing "inject" at <.EstimatedConcurrency>: can't evaluate field EstimatedConcurrency in type *inject.SidecarTemplateData

Solution:

In vaulues.yaml, make below change:

pilot:

  # Can be a full hub/image:taggcr.io/istio-release
  image: gcr.io/istio-release/pilot:1.16.5

Thursday, May 18, 2023

Logrotate

 

```

# cat /etc/logrotate.d/vault

/opt/vault/audit/audit.log {

    daily

    rotate 365

    compress

    missingok

    notifempty

    dateext

    dateformat %Y-%m-%d.

    create 0600 vault vault

    postrotate

        /bin/kill -HUP `cat /run/vault/vault.pid 2>/dev/null` 2> /dev/null || true

    endscript

}

```

Tuesday, May 2, 2023

Reference: 

https://stackoverflow.com/questions/11623862/fetch-in-git-doesnt-get-all-branches

Problem:

$ git checkout origin/INF-2308

error: pathspec 'origin/INF-2308' did not match any file(s) known to git

Solution: 

The problem can be seen when checking the remote.origin.fetch setting

(The lines starting with $ are bash prompts with the commands I typed. The other lines are the resulting output)

$ git config --get remote.origin.fetch
+refs/heads/master:refs/remotes/origin/master

As you can see, in my case, the remote was set to fetch the master branch specifically and only. I fixed it as per below, including the second command to check the results.

$ git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
$ git config --get remote.origin.fetch
+refs/heads/*:refs/remotes/origin/*
$ git checkout INF-2308

Thursday, January 26, 2023

 Problem:

We're sorry but jfrog webapp doesn't work properly without JavaScript enabled. Please enable it to continue.

Reference:

https://www.haproxy.com/blog/enabling-cors-in-haproxy/