Get-DistinguishedNameParent

function Get-DistinguishedNameParent {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
        [string]$distinguishedName
    )
    begin {}

    process {
        foreach ($Item In $distinguishedName) {
            $ParentOctets = $Item.Replace('\,', 'R3S3RV3D4R3PLAC3').Split(',') | Select-Object -Skip 1
            $ParentRaw = $ParentOctets -join ','
            $ParentRaw.Rep

Build -MultiPASS

Saved from https://github.com/seanec327/multipass
cd <multipass>
apt install devscripts equivs
mk-build-deps -s sudo -i

cd <multipass>
git submodule update --init --recursive
mkdir build
cd build
cmake ../
make

sudo apt update
sudo apt install libgl1 libpng16-16 libqt6core6 libqt6gui6 \
    libqt6network6 libqt6widgets6 libxml2 libvirt0 dnsmasq-base \
    dnsmasq-utils qemu-system-x86 qemu-utils libslang2 iproute2 \
    iptables iputils-ping libatm1 libxtables12 xterm

sudo <multipass>/build/bin/multipassd &
mkdir -p ~/.local/share/multipass/

Vue.js - Renderless pattern

<!-- MouseTracker.vue -->
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
  
const x = ref(0)
const y = ref(0)

const update = e => {
  x.value = e.pageX
  y.value = e.pageY
}

onMounted(() => window.addEventListener('mousemove', update))
onUnmounted(() => window.removeEventListener('mousemove', update))
</script>

<template>
  <slot :x="x" :y="y"/>
</template>

<!-- Usage: -->
<template>
	<MouseTracker v-slot="{ x, y }">
  	Mouse is at: {{ x }}, {{ y }}
	</MouseTracker>
</templ

Javascript Class

class MyClass {
  constructor(value){
    this.property = value;
  }
  
  getProperty(){
    return this.property;
  }
  
  setProperty(newValue){
    this.property = newValue;
  }
}

class MySecondClass extends MyClass {
  constructor(value){
    super(value);
    this.secondProperty = 0;
  }
  
  getFunction() {
    return this.secondProperty;
  }
}

const testClass = new MyClass("test");
testClass.getProperty();
testClass.setProperty("test2");
testClass.getFunction();

Vue.js - Provide pattern

<!-- https://www.patterns.dev/vue/data-provider -->

<!-- Provider.vue -->
<template>
  <slot :data="data" :loading="loading"></slot>
</template>

<script setup>
  import { ref, reactive } from "vue";

  const API_ENDPOINT_URL = "https://official-joke-api.appspot.com/random_joke";

  const data = reactive({
    setup: null,
    punchline: null,
  });
  const loading = ref(false);

  const fetchJoke = async () => {
    loading.value = true;

    const response = await fetch(API_ENDPOINT_URL);
   

Get flag emoji by country code

function getFlagEmoji(countryCode) {
  return countryCode.toUpperCase().replace(/./g, char => 
      String.fromCodePoint(127397 + char.charCodeAt())
  );
}

1219. Path with Maximum Gold

In a gold mine grid of size m x n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty. Return the maximum amount of gold you can collect under the conditions: Every time you are located in a cell you will collect all the gold in that cell. From your position, you can walk one step to the left, right, up, or down. You can't visit the same cell more than once. Never visit a cell with 0 gold. You can start and stop collecting gold from any position in the grid that has some gold.
const getMaximumGold = (grid) => {
    const rows = grid.length; // Number of rows in the grid
    const cols = grid[0].length; // Number of columns in the grid
    let maxGold = 0; // Variable to store the maximum gold collected

    // Function to traverse the grid from a given cell
    const traverse = (row, col) => {
        // If the cell is out of bounds or has no gold, return 0
        if (row < 0 || col < 0 || row >= rows || col >= cols || !grid[row][col]) {
            return 0;
       

Get-DirectoryHash

function Get-DirectoryHash {
    [CmdletBinding()]
    param(
        [System.IO.DirectoryInfo]
        $Path
        ,
        [switch]
        $IncludeName
    )

    begin {
        function Get-StringHash {
            [CmdletBinding()]
            PARAM(
                [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
                [AllowNull()]
                [AllowEmptyString()]
                [String]$St

CSS Grid

.wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-gap: 10px;
}

.box {
  background-color: #20262e;
  color: #fff;
  border-radius: 3px;
  padding: 20px;
  font-size: 14px;
}

Gerrit git push commands

git add . 

git commit --amend 

git push origin HEAD:refs/for/master -f 

Command line MySQL import

# Clever Cloud DB
mysql -h <db_name>-mysql.services.clever-cloud.com -P <db_port> -u <db_user> -p <db_name> < YOUR_BACKUP_FILE.sql

# Local Docker DB
mysql --host=<db_host> --port=<db_port> --user=<db_user> --password=<db_pwd> --database=<db_name> < YOUR_BACKUP_FILE.sql

API JSON apison exportacion cabecera 404 500 error errores

# Hacer que una función retorne un json público
Si estamos haciendo una API, puede ser que queramos retornar un JSON. Para ello haremos una función normal, en QUID, solo tendremos en cuenta estas cosas:

* **Agregar la función al "Espacio Exportación"** (config_app.php en espacios/exportacion)
* Establecer el header del **Content-type** de la respuesta JSON: 
```php
header('Content-Type: application/json');
``` 
* Tener en cuenta que la función quizás puede retornar **códigos de error**, esto se

Esempio autocomplete in ajax (Wordpress)

http://dev.networksail.com/
				<form id="headerHomeForm" action="<?php echo get_post_type_archive_link('barca'); ?>" method="post">
					<div class="container-fluid container-xxl">
						<div class="row">
							<div class="col-12 col-lg-10 mx-auto">
								<div class="row gx-3 gy-3 gy-lg-0 formWrapper">
									<div class="col-12 col-lg-3 col-xxl-4 position-relative">
										<label for="porto_text" class="w-100">
											<input name="porto" id="porto" type="hidden">
											<input name="porto_text" aut

memcached key 조회

First, Telnet to your server:

telnet 127.0.0.1 11211
Next, list the items to get the slab ids:

stats items
STAT items:3:number 1
STAT items:3:age 498
STAT items:22:number 1
STAT items:22:age 498
END
The first number after ‘items’ is the slab id. Request a cache dump for each slab id, with a limit for the max number of keys to dump:

stats cachedump 3 100
ITEM views.decorators.cache.cache_header..cc7d9 [6 b; 1256056128 s]
END

stats cachedump 22 100
ITEM views.decorators.cache.cache_page..8427e

Lieferantenbestellung öffnen SP

Ändert den Status einer Lieferantebestellung. Dadurch lässt sich eine Abgeschlossene Bestellung wieder bearbeiten. kLieferantenbestellung muss einfach als Ganzzahl eingetragen werden.
DECLARE @RC int
DECLARE @kLieferantenBestellung int
DECLARE @nStatus int

EXECUTE @RC = [Lieferantenbestellung].[spLieferantenBestellungStatusAendern] 
   @kLieferantenBestellung = [KLIEFERANTENBESTELLUNG]
  ,@nStatus = 20 /* 20 = in Bearbeitung, 500 = Abgeschlossen */
GO

Django get url parameters and pass to link or pagination

Use case: If you are using url parameters to filter result, it must carry the parameter to next pagination link
{% load custom_filters %}

<a href="?{% query_transform page=records.previous_page_number %}" class="relative inline-flex items-center rounded-l-md px-2 py-2 text-gray-400 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
    <span class="sr-only">Previous</span>
</a>