C++ Project

Create a c++ project that has - integrated package manager **vcpkg** - use **cmake** for the project generation - creates **docker** files from pre-built local project to save time - uses **docker compose** to start the app
git submodule add git@github.com:microsoft/vcpkg.git tools/vcpkg

🤖 LLM - Multimodal - Create Image Message

import base64
import mimetypes


def create_image_message(image_path: str) -> dict:
    # Open the image file in "read binary" mode
    with open(image_path, "rb") as image_file:
        # Read the contents of the image as a bytes object
        binary_data = image_file.read()
    # Encode the binary data using Base64 encoding
    base64_encoded_data = base64.b64encode(binary_data)
    # Decode base64_encoded_data from bytes to a string
    base64_string = base64_encoded_data.decode('utf-8')
   

partitioning logic


// Partition using the Lomuto partition scheme
int partition(int a[], int start, int end)
{
    // Pick the rightmost element as a pivot from the array
    int pivot = a[end];
 
    // elements less than the pivot will be pushed to the left of `pIndex`
    // elements more than the pivot will be pushed to the right of `pIndex`
    // equal elements can go either way
    int pIndex = start;
 
    // each time we find an element less than or equal to the pivot, `pIndex`
    // is incremented, and

802. Find Eventual Safe States

There is a directed graph of n nodes with each node labeled from 0 to n - 1. The graph is represented by a 0-indexed 2D integer array graph where graph[i] is an integer array of nodes adjacent to node i, meaning there is an edge from node i to each node in graph[i]. A node is a terminal node if there are no outgoing edges. A node is a safe node if every possible path starting from that node leads to a terminal node (or another safe node). Return an array containing all the safe nodes of the graph. The answer should be sorted in ascending order.
/**
 * @param {number[][]} graph
 * @return {number[]}
 */
var eventualSafeNodes = function(graph) {
    const n = graph.length;
    const safeNodes = [];

    // This array keeps track of node states: 0 (unvisited), 1 (visiting), 2 (sage)
    const state = new Array(n).fill(0);

    // Helper function to check if a node is safe
    function isSafe(node) {
        if (state[node] > 0) {
            return state[node] === 2;
        }
        state[node] = 1; // Mark as visiting
        for (cons

Get AAD Groups for a User

https://learn.microsoft.com/en-us/powershell/module/azuread/get-azureadusermembership?view=azureadps-2.0
## Get AD-User Groups for a User in Azure

In Azure Cloudshell connect to your tenant. Then use:

```powershell
Connect-AzureAD

$uid = $(Get-AzADUser -SignedIn).AdditionalProperties.id

Get-AzureADUserMembership -ObjectId $uid
```

Other useful commands:

```powershell
Get-AzADGroup [-Displayname xyz]

Get-AzADGroupMember -GroupDisplayName xyz
```

Spinner

this.showMainSpinner(this.l('Uploading'));
this.hideMainSpinner();

// -- or --

private ngxSpinnerTextService: NgxSpinnerTextService;

constructor(
  injector: Injector,
  private _spinnerService: NgxSpinnerService)
{
  this.ngxSpinnerTextService = injector.get(NgxSpinnerTextService)
}

this.ngxSpinnerTextService.setText(spinnerTexts.processingStep);
this._spinnerService.show();

this.ngxSpinnerTextService.setText(spinnerTexts.default);
this._spinnerService.hide();

first snippet

## test1
this is my first snippet

Bash find w/ directory excluded and args piped

find . -type d -name coverage-unit -not -path "*/node_modules/*" | xargs -I {} rm -rf {} 

first snippet

## test1
this is my first snippet

Liquid - Products slider section

{{ 'component-card.bf.build.css' | asset_url | stylesheet_tag }}
{{ 'component-price.bf.build.css' | asset_url | stylesheet_tag }}

{{ 'component-slider.bf.build.css' | asset_url | stylesheet_tag }}
{{ 'slider-product.bf.build.css' | asset_url | stylesheet_tag }}

{%- if section.settings.enable_quick_add -%}
  {{ 'quick-add.bf.build.css' | asset_url | stylesheet_tag }}
  <script src="{{ 'quick-add.js' | asset_url }}" defer="defer"></script>
  <script src="{{ 'product-form.js' | asset_ur

CSS View function

https://jsbin.com/jegerowode/edit?html,output

docker-compose

# 共享目录

```
version: '3.8'

services:
  data:
    image: xxx
    command: sh -c "while true; do sleep 5; done"
    volumes:
        - shared_data:/data

  app:
    image: xxx
    ports:
      - "10002:80"
    environment:
      - ENV_A=XXX
    volumes:
      - shared_data:/workspace/data
    user: "kna:kna"
    depends_on:
      - model
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              capabilities: [gpu]
              device_ids: ["

dls3 tables

psql

CREATE TEMPORARY TABLE tmp (enc_key varchar,r_year numeric, regid varchar,lpno varchar, chf_flag varchar);
\COPY tmp (enc_key,r_year,regid ,lpno , chf_flag ) FROM 202401.01_001_cohortpool_abs_deat.txt;
\pset format unaligned
\pset tuples_only on
\pset fieldsep '\t'
\o cares_cohortpool_abs_deat.psql
select t.enc_key, cm.chain_id, cm.oldsys_root, d.lpno||'E', d.r_year, d.regid, t.chf_flag ,d.dob, d.dod1
FROM deathdata d
JOIN tmp t ON t.regid=d.regid and t.r_year=d.r_year
JOIN demo

Shopify - Schema example

{
  "name": "Name",
  "class": "section section-padding",
  "disabled_on": {
    "groups": ["header", "footer"]
  },
  "settings": [
    {
      "type": "metaobject",
      "metaobject_type": "kits_compare",
      "id": "compare_item",
      "label": "Compare Item"
    },
    {
      "type": "metaobject_list",
      "metaobject_type": "latest_news",
      "id": "latest_news",
      "label": "Latest news"
    },
    {
      "type": "range",
      "id": "range_item",
      "l

1267. Count Servers that Communicate

You are given a map of a server center, represented as a m * n integer matrix grid, where 1 means that on that cell there is a server and 0 means that it is no server. Two servers are said to communicate if they are on the same row or on the same column. Return the number of servers that communicate with any other server.
/**
 * @param {number[][]} grid
 * @return {number}
 */
var countServers = function(grid) {
    const m = grid.length;
    const n = grid[0].length;
    const rowCount = new Array(m).fill(0); // Array to store the count of servers in each row
    const colCount = new Array(n).fill(0); // Array to store the count of servers in each column

    // Fill the rowCount and colCount arrays
    for (let i = 0; i < m; i++) {
        for (let j = 0; j < n; j++) {
            if (grid[i][j] === 1) {