Snippets Collections
# Build Ubuntu image with base functionality.
FROM ubuntu:focal AS ubuntu-base
ENV DEBIAN_FRONTEND noninteractive
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Setup the default user.
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo ubuntu
RUN echo 'ubuntu:ubuntu' | chpasswd
USER ubuntu
WORKDIR /home/ubuntu
# Build image with Python and SSHD.
FROM ubuntu-base AS ubuntu-with-sshd
USER root
# Install required tools.
RUN apt-get -qq update \
    && apt-get -qq --no-install-recommends install vim-tiny=2:8.1.* \
    && apt-get -qq --no-install-recommends install sudo=1.8.* \
    && apt-get -qq --no-install-recommends install python3-pip=20.0.* \
    && apt-get -qq --no-install-recommends install openssh-server=1:8.* \
    && apt-get -qq clean    \
    && rm -rf /var/lib/apt/lists/*
# Configure SSHD.
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
RUN mkdir /var/run/sshd
RUN bash -c 'install -m755 <(printf "#!/bin/sh\nexit 0") /usr/sbin/policy-rc.d'
RUN ex +'%s/^#\zeListenAddress/\1/g' -scwq /etc/ssh/sshd_config
RUN ex +'%s/^#\zeHostKey .*ssh_host_.*_key/\1/g' -scwq /etc/ssh/sshd_config
RUN RUNLEVEL=1 dpkg-reconfigure openssh-server
RUN ssh-keygen -A -v
RUN update-rc.d ssh defaults
# Configure sudo.
RUN ex +"%s/^%sudo.*$/%sudo ALL=(ALL:ALL) NOPASSWD:ALL/g" -scwq! /etc/sudoers
# Generate and configure user keys.
USER ubuntu
RUN ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
#COPY --chown=ubuntu:root "./files/authorized_keys" /home/ubuntu/.ssh/authorized_keys
# Setup default command and/or parameters.
EXPOSE 22
CMD ["/usr/bin/sudo", "/usr/sbin/sshd", "-D", "-o", "ListenAddress=0.0.0.0"]
class Solution{
  public:
    //Function to insert a node at the beginning of the linked list.
    Node *insertAtBegining(Node *head, int x)
    {
            
       Node* newnode=new Node(x);
       newnode->next=head;

       return newnode;
    }
    
    
    //Function to insert a node at the end of the linked list.
    Node *insertAtEnd(Node *head, int x)  
    {
        if(!head)
        {
            Node* newnode=new Node(x);
            return newnode;
        }
        Node* temp=head;
        while(temp->next!=NULL)
        {
            temp=temp->next;
        }
        Node* newnode=new Node(x);
        temp->next=newnode;
        return head;
    }
};
int isSorted(int n, vector<int> a)
{
    bool flag=false;
    for(int i=0 ; i<n-1 ; i++)
    {
      if (a[i] > a[i + 1]) {
        return 0;
      }
    }
    return 1;
}
in two traversal-
  
vector<int> getSecondOrderElements(int n, vector<int> a)
{
    int mini=INT_MAX;
    int maxi=INT_MIN;
    for(int i=0  ; i<n ; i++)
    {
        if(a[i]>maxi)
        {
            maxi=a[i];
        }
        if(a[i]<mini)
        {
            mini=a[i];
        }
    }
    vector<int>ans;
    int mi=INT_MAX;
    int ma=INT_MIN;
    for(int i=0 ; i<n ; i++)
    {
        if(a[i]>ma and a[i]!=maxi)
        {
              ma=a[i];
            
        }
        if(a[i]<mi and a[i]!=mini)
        {
            mi=a[i];
        }
    }
    ans.push_back(ma);
    ans.push_back(mi);
    return ans;
}

in single traversal-
  
int findSecondLargest(int n, vector<int> &arr)
{
    int largest=INT_MIN;
    int secondlargest=INT_MIN;
    for(int i=0 ; i<n ; i++)
    {
        if(arr[i]>largest)
        {
            secondlargest=largest;
            largest=arr[i];
        }
        if(arr[i]<largest and arr[i]>secondlargest)
        {
            secondlargest=arr[i];
        }
    }
    if(secondlargest==INT_MIN)
    {
        return -1;
    }
    return secondlargest;
}
Welcome to a cutting-edge crypto exchange platform, where innovation meets seamless trading experiences, similar to paxful. Here, users can confidently buy and sell a diverse range of cryptocurrencies within a highly secure and user-friendly environment. The platform empowers investors with a plethora of payment options to cater to their unique requirements. Whether seasoned or a newcomer to the crypto space, users benefit from an intuitive interface and robust security measures, that assures a hassle-free and trustworthy trading experience. To more information check here >> https://maticz.com/paxful-clone-script
Earliest Date

= #date(Date.Year(List.Min(Source[OrderDate])),1,1)

Latest Date

= #date(Date.Year(List.Max(Source[RequiredDate])),12,31)

(Dynamic) Calendar
let
    Source = {Number.From(pmEarliestDate)..Number.From(pmLatestDate)},
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type date}})
in
    #"Changed Type"
/----If we want to start slider in post type insert this code for cdn files--------/
 
function slick_cdn_enqueue_scripts(){
	wp_enqueue_style( 'slick-style', '//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css' );
	wp_enqueue_script( 'slick-script', '//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js', array(), null, true );
}
add_action( 'wp_enqueue_scripts', 'slick_cdn_enqueue_scripts' );
 
 
 
/----------------------- Custom Post type Services ------------------------------------/
//Services Post Type
add_action('init', 'services_post_type_init');
function services_post_type_init()
{
 
    $labels = array(
 
        'name' => __('Services', 'post type general name', ''),
        'singular_name' => __('Services', 'post type singular name', ''),
        'add_new' => __('Add New', 'Services', ''),
        'add_new_item' => __('Add New Services', ''),
        'edit_item' => __('Edit Services', ''),
        'new_item' => __('New Services', ''),
        'view_item' => __('View Services', ''),
        'search_items' => __('Search Services', ''),
        'not_found' =>  __('No Services found', ''),
        'not_found_in_trash' => __('No Services found in Trash', ''),
        'parent_item_colon' => ''
    );
    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'rewrite' => true,
        'query_var' => true,
        'menu_icon' => get_stylesheet_directory_uri() . '/images/testimonials.png',
        'capability_type' => 'post',
        'hierarchical' => true,
        'public' => true,
        'has_archive' => true,
        'show_in_nav_menus' => true,
        'menu_position' => null,
        'rewrite' => array(
            'slug' => 'services',
            'with_front' => true
        ),
        'supports' => array(
            'title',
            'editor',
            'thumbnail'
        )
    );
 
    register_post_type('services', $args);
}
 
 
=============================
SHORTCODE
=============================
 
// Add Shortcode [our_services];
add_shortcode('our_services', 'codex_our_services');
function codex_our_services()
{
    ob_start();
    wp_reset_postdata();
?>
 
    <div class="row ">
        <div id="owl-demo" class="owl-carousel ser-content">
            <?php
            $arg = array(
                'post_type' => 'services',
                'posts_per_page' => -1,
            );
            $po = new WP_Query($arg);
            ?>
            <?php if ($po->have_posts()) : ?>
 
                <?php while ($po->have_posts()) : ?>
                    <?php $po->the_post(); ?>
                    <div class="item">
                        <div class="ser-body">
                            <a href="#">
                                <div class="thumbnail-blog">
                                    <?php echo get_the_post_thumbnail(get_the_ID(), 'full'); ?>
                                </div>
                                <div class="content">
                                    <h3 class="title"><?php the_title(); ?></h3>
<!--                                     <p><?php //echo wp_trim_words(get_the_content(), 25, '...'); ?></p> -->
                                </div>
                            </a>
                            <div class="readmore">
                                <a href="<?php echo get_permalink() ?>">Read More</a>
                            </div>
                        </div>
                    </div>
                <?php endwhile; ?>
 
            <?php endif; ?>
        </div>
    </div>
 
 
<?php
    wp_reset_postdata();
    return '' . ob_get_clean();
}
add_filter('use_block_editor_for_post', '__return_false', 10);
add_filter( 'use_widgets_block_editor', '__return_false' )
   var _email = new MimeMessage();
            _email.From.Add(MailboxAddress.Parse(_config.GetSection("EmailConfiguration:Username").Value));
            _email.To.AddRange(to.Select(x => MailboxAddress.Parse(x)).ToList());
            _email.Subject = request.Subject;

            if (parameters != null)
            {
                foreach (var parameter in parameters)
                {
                    request.Body = request.Body.Replace(parameter.Key, parameter.Value);
                }
            }

            _email.Body = new TextPart(TextFormat.Html) { Text = request.Body };

            using var smtp = new SmtpClient();
            await smtp.ConnectAsync(_config.GetSection("EmailConfiguration:Host").Value, 587, SecureSocketOptions.StartTls);
            await smtp.AuthenticateAsync(_config.GetSection("EmailConfiguration:Username").Value, _config.GetSection("EmailConfiguration:Password").Value);
            await smtp.SendAsync(_email);
            await smtp.DisconnectAsync(true);
services.AddHangfire(x => x.UseStorage(
             new OracleStorage(
             Configuration.GetConnectionString("ConnectionString"),
             new OracleStorageOptions
             {
                 TransactionIsolationLevel = System.Data.IsolationLevel.ReadCommitted,
                 QueuePollInterval = TimeSpan.FromSeconds(15),
                 JobExpirationCheckInterval = TimeSpan.FromHours(1),
                 CountersAggregateInterval = TimeSpan.FromMinutes(5),
                 PrepareSchemaIfNecessary = true,
                 DashboardJobListLimit = 50000,
                 TransactionTimeout = TimeSpan.FromMinutes(1),
                 SchemaName = appSettings.DatabaseSchema
             })
            ));
            services.AddHangfireServer();
----------------------------------------------------------
  app.UseHangfireDashboard("/hangfiredash", new DashboardOptions
            {
                DashboardTitle = "Sample Jobs",
                Authorization = new[]
            {
                new  HangfireAuthorizationFilter("admin")
            }
            });
--------------------------------Cron Expression--------------------------
https://crontab.guru/#00_01_*/01_*_*
<!DOCTYPE html>

<html>

<head>

<meta name="_token" content="{{ csrf_token() }}">



<title>Live Search</title>

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>

</head>

<body>

<div class="container">

<div class="row">

<div class="panel panel-default">

<div class="panel-heading">

<h3>Products info </h3>

</div>

<div class="panel-body">

<div class="form-group">

<input type="text" class="form-controller" id="search" name="search"></input>

</div>

<table class="table table-bordered table-hover">

<thead>

<tr>

<th>ID</th>

<th>Product Name</th>

<th>Description</th>

<th>Price</th>

</tr>

</thead>

<tbody>

</tbody>

</table>

</div>

</div>

</div>

</div>

<script type="text/javascript">

$('#search').on('keyup',function(){

$value=$(this).val();

$.ajax({

type : 'get',

url : '{{URL::to('search')}}',

data:{'search':$value},

success:function(data){

$('tbody').html(data);

}

});



})

</script>

<script type="text/javascript">

$.ajaxSetup({ headers: { 'csrftoken' : '{{ csrf_token() }}' } });

</script>

</body>

</html>

1. Create File "Dockerfile" in same directory as "docker-compose.yaml"
2. Write 
FROM apache/airflow:2.0.2
RUN pip install --no-cache-dir geopandas another-package
3. Build new image:
docker build . --tag projectname-airflow:2.0.2
4. In "docker-compose.yaml" replace
image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.0.2}
with 
image: ${AIRFLOW_IMAGE_NAME:-projectname-airflow:2.0.2}
5. In Shell move to directory an run
docker build . --tag projectname-airflow:2.0.2
6. Epic win
Sub RemoveDuplicatesAndKeepLatest()
    Dim ws As Worksheet
    Set ws = [thisworkbook](/activeworkbook-thisworkbook/).Sheets("YourSheetName") ' Assign [Worksheet](/vba/sheets-worksheets) object to "ws". Replace "YourSheetName" with the actual sheet name

    ' Assuming Column D contains the timestamp
    Dim lastRow As Long
    lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row  ' Find the last row in the worksheet

    ' Perform sort operation based on columns 1,3 and timestamp in Column D (adjust accordingly)
    With ws.Sort
        .SortFields.Clear  
        .SortFields.Add Key:=ws.Range("A2:A" & lastRow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal   ' Sort on column A ascendingly
        .SortFields.Add Key:=ws.Range("C2:C" & lastRow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal   ' Sort on column C ascendingly
        .SortFields.Add Key:=ws.Range("D2:D" & lastRow), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal  ' Sort on column D descendingly (to keep the latest)
        .SetRange ws.Range("A1:AD" & lastRow) 
        .Header = xlYes  
        .MatchCase = False  
        .Orientation = xlTopToBottom  
        .SortMethod = xlPinYin  
        .Apply  ' Apply the sorting to the range
    End With

    ' Loop through the sorted range and remove duplicates, keeping the latest occurrence
    Dim currentRow As Long
    For currentRow = lastRow To 3 Step -1 ' Loop from the bottom of sheet to the top
        If ws.Cells(currentRow, 1).Value = ws.Cells(currentRow - 1, 1).Value And _
           ws.Cells(currentRow, 3).Value = ws.Cells(currentRow - 1, 3).Value Then
            ' If corresponding cells in Column A and Column C are identical, delete the current row
            ws.Rows(currentRow).Delete  ' Delete the row
        End If
    Next currentRow
End Sub
	&::-webkit-scrollbar {
		height: 10px;
	}

	&::-webkit-scrollbar-track {
		box-shadow: inset 0 0 5px grey;
		border-radius: 10px;
	}

	&::-webkit-scrollbar-thumb {
		border-radius: 10px;
		-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
		background: #2c3e50;
		border: solid 3px #1c2731;
	}
fxcsa8je5ypxmxl4x5aplh7364a02hkzmcnoe4rb
import java.net.*;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        try {
            // Step 1: Open a connection to the URL and create a BufferedReader to read from it
            URL url = new URL("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt");
            BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));

            // Step 2: Group words by sorted characters (anagrams)
            Map<String, List<String>> anagrams = reader.lines()
                    .collect(Collectors.groupingBy(Main::sortedString));

            // Step 3: Find the maximum number of anagrams in a single group
            int maxAnagrams = anagrams.values().stream()
                    .mapToInt(List::size)
                    .max()
                    .orElse(0);
          
			// Step 4: Print the group(s) with the maximum number of anagrams, sorted lexicographically

		// Stream through the values of the 'anagrams' map, which represent groups of anagrams
anagrams.values().stream()
        // Filter to include only groups with the maximum number of anagrams
        .filter(group -> group.size() == maxAnagrams)
        
        // For each qualifying group, sort its elements lexicographically
        .peek(Collections::sort)
        
        // Sort the groups based on the lexicographically first element of each group
        .sorted(Comparator.comparing(list -> list.get(0)))
        
        // For each sorted group, print it as a space-separated string
        .forEach(group -> System.out.println(String.join(" ", group)));
          
          
                // Step 5: Close the BufferedReader
            reader.close();
        } catch (IOException e) {
            // Handle IOException if it occurs
            e.printStackTrace();
        }
    }

private static String sortedString(String word) {
    // Step 1: Convert the word to a character array
    char[] letters = word.toCharArray();
    
    // Step 2: Sort the characters in lexicographic order
    Arrays.sort(letters);
    
    // Step 3: Create a new string from the sorted character array
    return new String(letters);
}
Create Custom Post Type:
Open your theme's functions.php file and add the following code:


Copy code
function create_carousel_post_type() {
    register_post_type('carousel',
        array(
            'labels' => array(
                'name' => __('Carousel Items'),
                'singular_name' => __('Carousel Item'),
            ),
            'public' => true,
            'has_archive' => true,
            'supports' => array('title', 'thumbnail', 'custom-fields'),
        )
    );
}
add_action('init', 'create_carousel_post_type');
  
  
  
  
  
  
  
  Create a Shortcode for Carousel:
Add the following code to create a shortcode that generates a Swiper-based carousel using the custom post type:


Copy code
function carousel_shortcode() {
    ob_start();

    $carousel_items = new WP_Query(array('post_type' => 'carousel', 'posts_per_page' => -1));

    ?>
    <div class="myswiper">
        <div class="swiper">
            <div class="swiper-wrapper">
                <?php
                while ($carousel_items->have_posts()) : $carousel_items->the_post();
                    ?>
                    <div class="swiper-slide">
                        <div class="card">
                            <div class="card__image"><?php the_post_thumbnail('full', array('alt' => get_the_title())); ?>
                                <h2 class="card__title"><?php the_title(); ?></h2>
                            </div>
                        </div>
                    </div>
                    <?php
                endwhile;
                wp_reset_postdata();
                ?>
            </div>
            <div class="swiper-button-prev"></div>
            <div class="swiper-button-next"></div>
        </div>
        <div class="swiper-pagination"></div>
    </div>
    <?php

    return ob_get_clean();
}
add_shortcode('carousel', 'carousel_shortcode');
  
  
  
  
  
  
  <!-- Swiper CSS -->
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />

<!-- Swiper JS -->
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
  
  
  
  
  document.addEventListener('DOMContentLoaded', function () {
    const swiper = new Swiper('.swiper', {
        loop: true,
        slidesPerView: 4,
        centeredSlides: true,
        autoplay: {
            enabled: true,
            delay: 5000
        },
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
        },
    });
});
  
  
  
  function enqueue_portfolio_scripts() {
    wp_enqueue_style('swiper-style', 'https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.3.1/css/swiper.min.css');
    wp_enqueue_script('swiper-script', 'https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.3.1/js/swiper.min.js', array('jquery'), null, true);
    wp_enqueue_script('portfolio-script', get_template_directory_uri() . '/path/to/your-portfolio-script.js', array('swiper-script'), null, true);
    wp_enqueue_style('portfolio-style', get_template_directory_uri() . '/path/to/your-portfolio-style.css');
}
add_action('wp_enqueue_scripts', 'enqueue_portfolio_scripts');
  
// in UE script, make sure you resolve properly the suitlet external URL:
var suitletURL = url.resolveScript({
        scriptId: 'customscript_your_suitlet_scriptid',
        deploymentId: 'customdeploy_your_suitlet_deploymentid',
        returnExternalUrl: true
});

var response = https.post({
        url : suitletURL,
        headers : myHeaders,
        body : myBody
});
dir "C:\path\to\files" -include *.txt -rec | gc | out-file "C:\path\to\output\file\joined.txt"
JupyterHub.ensureService({waitForReady:true})
for /R %f in (*.txt) do type “%f” >> c:\Test\output.txt
$files = (dir *.txt)
$outfile = "out.txt"

$files | %{
    $_.FullName | Add-Content $outfile
    Get-Content $_.FullName | Add-Content $outfile
}
 if you only want the filename, but not the path, switch the line which is $_.FullName | Add-Content $outfile to read $_.Name | Add-Content $outfile
Get-ChildItem d:\scripts -include *.txt -rec | ForEach-Object {gc $_; ""} | out-file d:\scripts\test.txt
$yourdir="c:\temp\"
$destfile= ([Environment]::GetFolderPath("Desktop") + "\totalresult.txt")
Get-ChildItem $yourdir -File -Filter *.txt | %{"________________________" |out-file  $destfile -Append; $_.Name  | Out-File  $destfile -Append; gc $_.FullName | Out-File  $destfile -Append}
<p><embed src="https://www.instagram.com/leecosheriffal/embed/?cr=1&amp;v=14&amp;wp=1080&amp;rd=https%3A%2F%2Fcdpn.io&amp;rp=%2Fcpe%2Fboomboom%2Findex.html%3Fkey%3Dindex.html-fcf10232-f752-7989-78a4-2f978a8ff956#%7B%22ci%22%3A0%2C%22os%22%3A228.39999999850988%2C%22ls%22%3A109.09999999962747%2C%22le%22%3A225.19999999925494%7D" /></p>
<p><embed src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Ffacebook.com%2FleeCoSheriffAL&amp;tabs=timeline&amp;width=500&amp;height=500&amp;small_header=false&amp;adapt_container_width=true&amp;hide_cover=false&amp;show_facepile=false&amp;appId" width="500" height="500" /></p>
# Turn on cluster nodes
clusterctrl on
# update master
sudo apt update && sudo apt dist-upgrade -y

# Add nodes to hosts file
sudo vi /etc/hosts
172.19.181.1	p1
172.19.181.2	p2
172.19.181.3	p3
172.19.181.4	p4

# Upgrade nodes
ssh p1 'sudo apt update && sudo apt dist-upgrade -y'
ssh p2 'sudo apt update && sudo apt dist-upgrade -y'
ssh p3 'sudo apt update && sudo apt dist-upgrade -y'
ssh p4 'sudo apt update && sudo apt dist-upgrade -y'

# enable memory cgroup on all raspberries
sudo vi /boot/cmdline.txt
cgroup_memory=1 cgroup_enable=memory

# Download k3sup
sudo curl -sLS https://get.k3sup.dev | sh
sudo cp k3sup-arm64 /usr/local/bin/k3sup

# Install k3sup without servicelb so we can use metalLB later
k3sup install --ip 172.19.181.254 --user $(whoami) --ssh-key ~/.ssh/kubemaster --k3s-extra-args '--disable servicelb'

# Copy config file to user
sudo cp /etc/k3s/kubeconfig ~/.kube/

# Export the file
export KUBECONFIG=~/.kube/kubeconfig
# Install on nodes
k3sup join --ip 172.19.181.1 --server-ip 172.19.181.254 --user $(whoami) --ssh-key ~/.ssh/kubemaster
k3sup join --ip 172.19.181.2 --server-ip 172.19.181.254 --user $(whoami) --ssh-key ~/.ssh/kubemaster
k3sup join --ip 172.19.181.3 --server-ip 172.19.181.254 --user $(whoami) --ssh-key ~/.ssh/kubemaster
k3sup join --ip 172.19.181.4 --server-ip 172.19.181.254 --user $(whoami) --ssh-key ~/.ssh/kubemaster
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 119.5G 0 disk
└─sda1 8:1 1 119.5G 0 part
  
sudo umount /dev/sda1
sudo mkfs.ext4 /dev/sda1
sudo mkdir /media/nfstorage
sudo chown nobody.nogroup -R /media/nfstorage
sudo chmod -R 777 /media/nfstorage

blkid 
# Copy UUID=”a13c2fad-7d3d-44ca-b704-ebdc0369260e”
sudo vi /etc/fstab
# Add the following line to the bottom of the fstab file:
UUID=a13c2fad-7d3d-44ca-b704-ebdc0369260e /media/nfstorage ext4 defaults 0 2

# NFS server is installed
sudo apt-get install -y nfs-kernel-server

sudo vi /etc/exports
# add the following line at the bottom
/media/nfstorage 172.19.181.0/24(rw,sync,no_root_squash,no_subtree_check)

sudo exportfs -a

# On each node p1,p2,p3,pN
sudo apt-get install -y nfs-common
sudo mkdir /media/nfstorage
sudo chown nobody.nogroup /media/nfstorage
sudo chmod -R 777 /media/nfstorage
# Set up automatic mounting by editing your /etc/fstab:
sudo vi /etc/fstab
# Add this line to the bottom:
172.19.181.254:/media/nfstorage /media/nfstorage nfs defaults 0 0

sudo mount -a
# Setup SSH On Desktop
ssh-keygen -t Ed25519
cat ~/.ssh/id_rsa.pub

# Setup SSH For Raspberry Master
ssh-keygen -t ed25519 -f ~/.ssh/kubemaster

# Copy keyset to raspbery master
scp kubemaster kubemaster.pub <user>@<IP>:~/.ssh/

# Use Raspberry pi imager to flash with user,wifi,hostname and keyset configured.
# Remember to add ssh file in boot

# Setup SSH Config File
$ vi ~/.ssh/config
Host p1
    Hostname 172.19.181.1
    User <user>
    IdentityFile ~/.ssh/kubemaster
Host p2
    Hostname 172.19.181.2
    User <user>
    IdentityFile ~/.ssh/kubemaster
Host p3
    Hostname 172.19.181.3
    User <user>
    IdentityFile ~/.ssh/kubemaster
Host p4
    Hostname 172.19.181.4
    User <user>
    IdentityFile ~/.ssh/kubemaster

# Enable nodes
$ sudo clusterhat on

# ensure systime is synced
sudo apt-get install -y ntpdate
# include <stdio.h>
# define MAX 6
int CQ[MAX];
int front = 0;
int rear = 0;
int count = 0;
void insertCQ(){
int data;
if(count == MAX) {
printf("\n Circular Queue is Full");
}
else {
printf("\n Enter data: ");
scanf("%d", &data);
CQ[rear] = data;
rear = (rear + 1) % MAX;
count ++;
printf("\n Data Inserted in the Circular Queue ");
    }
}
void deleteCQ()
{
    if(count == 0) {
        printf("\n\nCircular Queue is Empty..");
        
    }
        else {
            printf("\n Deleted element from Circular Queue is %d ", CQ[front]);
            front = (front + 1) % MAX;
            count --; 
        }
}
void displayCQ()
{
    int i, j;
    if(count == 0) {
        printf("\n\n\t Circular Queue is Empty "); }
        else {
            printf("\n Elements in Circular Queue are: ");
            j = count;
            for(i = front; j != 0; j--) {
                printf("%d\t", CQ[i]);
                i = (i + 1) % MAX; 
            }
        } 
}
int menu() {
    int ch;
    printf("\n \t Circular Queue Operations using ARRAY..");
    printf("\n -----------**********-------------\n");
    printf("\n 1. Insert ");
    printf("\n 2. Delete ");
    printf("\n 3. Display");
    printf("\n 4. Quit ");
    printf("\n Enter Your Choice: ");
    scanf("%d", &ch);
    return ch;
    
}
void main(){
    int ch;
    do {
        ch = menu();
        switch(ch) {
            case 1: insertCQ(); break;
            case 2: deleteCQ(); break;
            case 3: displayCQ(); break;
            case 4:
            return;
            default:
            printf("\n Invalid Choice ");
            
        }
        } while(1);
}
plt + ggplot2::theme(legend.position = "bottom")
   private enum TimeSpanElement
    {
        Millisecond,
        Second,
        Minute,
        Hour,
        Day
    }   
public static string ToFriendlyDisplay(this TimeSpan timeSpan, int maxNrOfElements = 3)
    {
        maxNrOfElements = Math.Max(Math.Min(maxNrOfElements, 5), 1);
        var parts = new[]
                        {
                            Tuple.Create(TimeSpanElement.Day, timeSpan.Days),
                            Tuple.Create(TimeSpanElement.Hour, timeSpan.Hours),
                            Tuple.Create(TimeSpanElement.Minute, timeSpan.Minutes),
                            Tuple.Create(TimeSpanElement.Second, timeSpan.Seconds),
                            Tuple.Create(TimeSpanElement.Millisecond, timeSpan.Milliseconds)
                        }
                                    .SkipWhile(i => i.Item2 <= 0)
                                    .Take(maxNrOfElements);

        return string.Join(", ", parts.Select(p => string.Format("{0} {1}{2}", p.Item2, p.Item1, p.Item2 > 1 ? "s" : string.Empty)));
    }
const beneficiaryArray = updatedBen.filter(
      (el: any) => el.parentProfileGUID === '',
    );
    console.log('beneficiaryArray', beneficiaryArray);

    // Substitute validation for all other willtypes (PW,FAW)
    // Get Array of all substitutes in the payload
    const substitutesArray = updatedBen.filter(
      (el: any) => el.parentProfileGUID !== '',
    ); // Filter out substitutes from payload
    console.log('substitutesArray', substitutesArray);
    // Check if the list of substitutes is updated for each iteration
    const substituteListForTest = checkSubstitutePresent(
      substitutesArray,
      beneficiaryList,
    );
    console.log('substituteListForTest', substituteListForTest);

    // New Method testing

    function filterPayloadByProperty(data:any) {
      const groups = data.reduce((result:any, item:any) => {
        const key = item.propertyGUID;
        if (!result[key]) {
          result[key] = [];
        }
        result[key].push(item);
        return result;
      }, {});

      return Object.values(groups);
    }

    function getSharesSum(arr:any) {
      return arr.map((subArray:any) => subArray.reduce((sum:any, num:any) => sum + num, 0));
    }

    const filteredData = filterPayloadByProperty(beneficiaryArray); // filter by propertyGUID
    console.log('filteredData', filteredData);

    const sharePercentages = filteredData.map((subArray:any) => subArray.map((obj:any) => obj.sharePercentage));

    console.log('sharePercentages', sharePercentages);

    const sums = getSharesSum(sharePercentages); // Sum of shares
    console.log('sums', sums);

    const validationTrue = sums.every((value:any) => value === 100); // Check if shares === 100
    console.log('valid', validationTrue);

    // if (validationTrue) {
    // dispatch<any>(submitshareDetails(isSpouseSelected ? spouseShares : husbandShares));
    // dispatch(setBySharesSubmitted(false));
    // handleNext(6, 'by-specific', isCompleted);
    // }

    // New Method testing end

    // Filter substitutes by property/account/company
    const filteredSubArrays = filterDataByPropertyGUID(substituteListForTest);
    console.log('filteredSubArrays', filteredSubArrays);
    // Calculate total sum of shares of the substitutes
    const substituteSharesTotalSum = calculateShareSum(filteredSubArrays);
    console.log('substituteSharesTotalSum', substituteSharesTotalSum);
    const substringsToRemove: string[] = ['undefined', 'null'];

    // Remove undefined and null values from the list
    const filteredObject = removeUndefinedAndNull(
      substituteSharesTotalSum,
      substringsToRemove,
    );
    console.log('filteredSubObject', filteredObject);

    // Remove Zeros from the list
    const removedZeros = removeZeroValues(filteredObject);
    console.log('removedZeros', removedZeros);

    // Condition to check substitute validation
    const subShareValidation = Object.values(removedZeros).every(
      (value) => value === 100,
    );

    // Substitute validation ends for all other WillTypes

    // Case 8 test ---
    // Normal Working case
    // const benCountList: any[] = updatedBenList1.filter(
    //   (ben: any) => ben.subBeneficiaryList.length !== 0 && ben.sharePercentage !== 0,
    // );
    const hus = updatedBenList1.filter(
      (ben: any) => ben.bookedForProfileGUID === profileGuid,
    );
    const spouse = updatedBenList1.filter(
      (ben: any) => ben.bookedForProfileGUID === spouseGuid,
    );
    const benCountList: any[] = (isSpouseSelected ? spouse : hus).filter(
      (ben: any) => ben.subBeneficiaryList?.length !== 0 && ben?.sharePercentage !== 0,
    );
    console.log('benCountList', benCountList);

    // Buisness Owners Will Substitute Validation

    // Check substitute validation in Buisness Owners Will
    // const substituteValidationBOW = checkSubstituteValidationBOW(
    //   subSharesBow,
    //   // benCountList,
    //   removedZeros,
    // );
    // console.log('substituteValidationBOW', substituteValidationBOW);

    // New test case --> Working but needs thorough testing
    // Add combined guids of propertyGUID and profileGUID
    const combinedArray = benCountList.map((obj: any) => ({
      ...obj,
      combinedGUID: `${obj.propertyGUID}-${obj.profileGUID}`,
    }));
    console.log('combinedArray', combinedArray);
    // Returns a list of shares and their corresponding combinedGUID's (propertyGUID + profileGUID)
    const subSharesList = getSharePercentages(combinedArray, removedZeros);
    console.log('subSharesArray', subSharesList);
    // Validate the substitute shares with the beneficiary shares
    const isSubstituteSharesValidBOW = validateShares(
      subSharesList,
      removedZeros,
    );
    console.log('isValid', isSubstituteSharesValidBOW);
    // Check if combinedGUID === key of substituteArray
    // const hasMatchingSharePercentage = checkSharePercentage(combinedArray, removedZeros);
    // console.log('hasMatchingSharePercentage', hasMatchingSharePercentage);

    // Check if substitute is present
    const isSubPresent = beneficiaryList.some(
      (el: any) => el.subBeneficiaryList.length !== 0,
    );

    const latestBenArray = updatedBen.filter((item1: any) => updatedBen.some(
      (item2: any) => item1.profileGUID === item2.parentProfileGUID,
    ));
    // console.log('latestBenArray', latestBenArray);
    const filteredLatestBenList = latestBenArray.filter(
      (e: any) => e.propertyGUID !== null,
    );
    console.log('filteredLatestBenList', filteredLatestBenList);
    const removeZeroFromBen = filteredLatestBenList.filter(
      (e: any) => e.sharePercentage !== 0,
    );
    console.log('removeZeroFromBen', removeZeroFromBen);

    // Substitute validation ends ---------------------------------------------------------------

    // Beneficiary Validation 2.0 (current version)
    // Get the total count of beneficiaries with substitutes
    // Check if the list of beneficiaries is updated for each iteration
    const beneficiaryListForTest = checkBeneficiaryPresent(
      beneficiaryArray,
      beneficiaryList,
    );
    console.log('beneficiaryListForTest', beneficiaryListForTest);

    // Filter beneficiaries by Property/Account/Company
    const filteredBenArrays = filterDataByPropertyGUID(beneficiaryListForTest);
    console.log('filteredBenArrays', filteredBenArrays);

    // Calculate total sum of shares of the beneficiaries of each property/account/company
    const benSharesTotalSum = calculateShareSum(filteredBenArrays);
    console.log('benSharesTotalSum', benSharesTotalSum);

    // Filter each beneficiary by property/account/company (Remove undefined and null values)
    const filteredObj = removeUndefinedAndNullForBen(benSharesTotalSum);
    console.log('filteredBenObj', filteredObj);

    // Condition to check beneficiary validation (Total shares === 100)
    const benShareValidation = Object.values(filteredObj).every(
      (value) => value === 100,
    );
    console.log('benShareValidation', benShareValidation);

    // Buisness Owners Will Beneficiary Validation
    const sharesForbow = getSharesForBOW(filteredObj);
    const sharesIterator = sharesForbow[Symbol.iterator]();
    console.log('sharesIterator', sharesIterator);

    // Beneficiary Validation for BOW
    const benShareValidationBOW = Object.values(filteredObj).every(
      (value) => value === sharesIterator.next().value,
    );
    console.log('benShareValidationBOW', benShareValidationBOW);

    const getListType = () => {
      if (willTypeID === 3) return propertyList;
      if (willTypeID === 5) return accountList;
      if (willTypeID === 4) return companyShareInformationList;
      return null;
    };

    const list = getListType();
    console.log('listType', list);

    // Check property/account/company list length
    const propertySharesObject = filterByPropertyList(
      filteredObj,
      list,
      willTypeID,
    );
    console.log('propertySharesObject', propertySharesObject);
    // propertyList || accountList || companyShareInformationList

    // Check if all properties/accounts/companies are allocated shares
    let checkLength: boolean;
    if (
      (accountList.length
        || propertyList.length
        || companyShareInformationList.length)
      === Object.keys(propertySharesObject).length
    ) {
      // Add Company List when working on BOW
      checkLength = true;
    }

    // Allow submission only if the shares have been allocated
    if (updatedBen.length !== 0 && checkLength) {
      // Property Will && Financial Assets Will
      if (willTypeID === 5 || willTypeID === 3) {
        // Financial Assets Will && Property Will
        if (isSubPresent) {
          // IF  substitute is present check validation for beneficiaries & substitutes
          const checkSubLength = benCountList.length === Object.keys(removedZeros).length;
          // const checkSubLength = benCountList.length === subCount * accountList.length;
          console.log('checkSubLength', checkSubLength);

          // if (substituteSharesList.length !== 0) {
          // Check beneficiary && substitute validation here
          if (
            benShareValidation
            && subShareValidation
            && checkSubLength
            // && filteredLatestBenList.length !== 0
          ) {
            // dispatch<any>(submitshareDetails(updatedBen));
            dispatch<any>(
              submitshareDetails(
                isSpouseSelected ? spouseShares : husbandShares,
              ),
            );
            dispatch(setBySharesSubmitted(false));
            handleNext(6, 'by-specific', isCompleted);
          } else {
            await dispatch(resetErrorState());
            await dispatch(
              setErrorInfo('Please enter shares for all substitutes'),
            );
          }
          // }
        } else if (!isSubPresent) {
          // Working smoothly -- Beneficiary Validation working with single & multiple accounts/properties
          // Beneficiary validation only
          if (benShareValidation) {
            dispatch<any>(
              submitshareDetails(
                isSpouseSelected ? spouseShares : husbandShares,
              ),
            );
            dispatch(clearUpdatedBenList());
            dispatch(setBySharesSubmitted(false));
            handleNext(6, 'by-specific', isCompleted);
          } else {
            await dispatch(resetErrorState());
            await dispatch(
              setErrorInfo('Please enter shares for all beneficiaries'),
            );
          }
        }
      } else {
        // Buisness Owners Will
        if (!isSubPresent) {
          if (benShareValidationBOW) {
            dispatch<any>(
              submitshareDetails(
                isSpouseSelected ? spouseShares : husbandShares,
              ),
            );
            dispatch(setBySharesSubmitted(false));
            handleNext(6, 'by-specific', isCompleted);
          } else {
            await dispatch(resetErrorState());
            await dispatch(
              setErrorInfo('Please enter shares for all beneficiaries'),
            );
          }
        } else if (isSubPresent) {
          // Substitute is present
          console.log('Substitute Present');
          const checkSubLength = benCountList.length === Object.keys(removedZeros).length;
          if (
            benShareValidationBOW
            // && substituteValidationBOW
            && isSubstituteSharesValidBOW
            && checkSubLength
            // && filteredLatestBenList.length !== 0
          ) {
            dispatch<any>(
              submitshareDetails(
                isSpouseSelected ? spouseShares : husbandShares,
              ),
            );
            dispatch(setBySharesSubmitted(false));
            handleNext(6, 'by-specific', isCompleted);
          } else {
            await dispatch(resetErrorState());
            await dispatch(
              setErrorInfo('Please enter shares for all substitutes'),
            );
          }
        }
      }
    } else {
      await dispatch(resetErrorState());
      await dispatch(setErrorInfo('Please assign the shares'));
    }
    // -----
const beneficiaryArray = updatedBen.filter(
      (el: any) => el.parentProfileGUID === '',
    );
    console.log('beneficiaryArray', beneficiaryArray);

    // Substitute validation for all other willtypes (PW,FAW)
    // Get Array of all substitutes in the payload
    const substitutesArray = updatedBen.filter(
      (el: any) => el.parentProfileGUID !== '',
    ); // Filter out substitutes from payload
    console.log('substitutesArray', substitutesArray);
    // Check if the list of substitutes is updated for each iteration
    const substituteListForTest = checkSubstitutePresent(
      substitutesArray,
      beneficiaryList,
    );
    console.log('substituteListForTest', substituteListForTest);

    // New Method testing

    function filterPayloadByProperty(data:any) {
      const groups = data.reduce((result:any, item:any) => {
        const key = item.propertyGUID;
        if (!result[key]) {
          result[key] = [];
        }
        result[key].push(item);
        return result;
      }, {});

      return Object.values(groups);
    }

    function getSharesSum(arr:any) {
      return arr.map((subArray:any) => subArray.reduce((sum:any, num:any) => sum + num, 0));
    }

    const filteredData = filterPayloadByProperty(beneficiaryArray); // filter by propertyGUID
    console.log('filteredData', filteredData);

    const sharePercentages = filteredData.map((subArray:any) => subArray.map((obj:any) => obj.sharePercentage));

    console.log('sharePercentages', sharePercentages);

    const sums = getSharesSum(sharePercentages); // Sum of shares
    console.log('sums', sums);

    const validationTrue = sums.every((value:any) => value === 100); // Check if shares === 100
    console.log('valid', validationTrue);

    // if (validationTrue) {
    // dispatch<any>(submitshareDetails(isSpouseSelected ? spouseShares : husbandShares));
    // dispatch(setBySharesSubmitted(false));
    // handleNext(6, 'by-specific', isCompleted);
    // }

    // New Method testing end

    // Filter substitutes by property/account/company
    const filteredSubArrays = filterDataByPropertyGUID(substituteListForTest);
    console.log('filteredSubArrays', filteredSubArrays);
    // Calculate total sum of shares of the substitutes
    const substituteSharesTotalSum = calculateShareSum(filteredSubArrays);
    console.log('substituteSharesTotalSum', substituteSharesTotalSum);
    const substringsToRemove: string[] = ['undefined', 'null'];

    // Remove undefined and null values from the list
    const filteredObject = removeUndefinedAndNull(
      substituteSharesTotalSum,
      substringsToRemove,
    );
    console.log('filteredSubObject', filteredObject);

    // Remove Zeros from the list
    const removedZeros = removeZeroValues(filteredObject);
    console.log('removedZeros', removedZeros);

    // Condition to check substitute validation
    const subShareValidation = Object.values(removedZeros).every(
      (value) => value === 100,
    );

    // Substitute validation ends for all other WillTypes

    // Case 8 test ---
    // Normal Working case
    // const benCountList: any[] = updatedBenList1.filter(
    //   (ben: any) => ben.subBeneficiaryList.length !== 0 && ben.sharePercentage !== 0,
    // );
    const hus = updatedBenList1.filter(
      (ben: any) => ben.bookedForProfileGUID === profileGuid,
    );
    const spouse = updatedBenList1.filter(
      (ben: any) => ben.bookedForProfileGUID === spouseGuid,
    );
    const benCountList: any[] = (isSpouseSelected ? spouse : hus).filter(
      (ben: any) => ben.subBeneficiaryList?.length !== 0 && ben?.sharePercentage !== 0,
    );
    console.log('benCountList', benCountList);

    // Buisness Owners Will Substitute Validation

    // Check substitute validation in Buisness Owners Will
    // const substituteValidationBOW = checkSubstituteValidationBOW(
    //   subSharesBow,
    //   // benCountList,
    //   removedZeros,
    // );
    // console.log('substituteValidationBOW', substituteValidationBOW);

    // New test case --> Working but needs thorough testing
    // Add combined guids of propertyGUID and profileGUID
    const combinedArray = benCountList.map((obj: any) => ({
      ...obj,
      combinedGUID: `${obj.propertyGUID}-${obj.profileGUID}`,
    }));
    console.log('combinedArray', combinedArray);
    // Returns a list of shares and their corresponding combinedGUID's (propertyGUID + profileGUID)
    const subSharesList = getSharePercentages(combinedArray, removedZeros);
    console.log('subSharesArray', subSharesList);
    // Validate the substitute shares with the beneficiary shares
    const isSubstituteSharesValidBOW = validateShares(
      subSharesList,
      removedZeros,
    );
    console.log('isValid', isSubstituteSharesValidBOW);
    // Check if combinedGUID === key of substituteArray
    // const hasMatchingSharePercentage = checkSharePercentage(combinedArray, removedZeros);
    // console.log('hasMatchingSharePercentage', hasMatchingSharePercentage);

    // Check if substitute is present
    const isSubPresent = beneficiaryList.some(
      (el: any) => el.subBeneficiaryList.length !== 0,
    );

    const latestBenArray = updatedBen.filter((item1: any) => updatedBen.some(
      (item2: any) => item1.profileGUID === item2.parentProfileGUID,
    ));
    // console.log('latestBenArray', latestBenArray);
    const filteredLatestBenList = latestBenArray.filter(
      (e: any) => e.propertyGUID !== null,
    );
    console.log('filteredLatestBenList', filteredLatestBenList);
    const removeZeroFromBen = filteredLatestBenList.filter(
      (e: any) => e.sharePercentage !== 0,
    );
    console.log('removeZeroFromBen', removeZeroFromBen);

    // Substitute validation ends ---------------------------------------------------------------

    // Beneficiary Validation 2.0 (current version)
    // Get the total count of beneficiaries with substitutes
    // Check if the list of beneficiaries is updated for each iteration
    const beneficiaryListForTest = checkBeneficiaryPresent(
      beneficiaryArray,
      beneficiaryList,
    );
    console.log('beneficiaryListForTest', beneficiaryListForTest);

    // Filter beneficiaries by Property/Account/Company
    const filteredBenArrays = filterDataByPropertyGUID(beneficiaryListForTest);
    console.log('filteredBenArrays', filteredBenArrays);

    // Calculate total sum of shares of the beneficiaries of each property/account/company
    const benSharesTotalSum = calculateShareSum(filteredBenArrays);
    console.log('benSharesTotalSum', benSharesTotalSum);

    // Filter each beneficiary by property/account/company (Remove undefined and null values)
    const filteredObj = removeUndefinedAndNullForBen(benSharesTotalSum);
    console.log('filteredBenObj', filteredObj);

    // Condition to check beneficiary validation (Total shares === 100)
    const benShareValidation = Object.values(filteredObj).every(
      (value) => value === 100,
    );
    console.log('benShareValidation', benShareValidation);

    // Buisness Owners Will Beneficiary Validation
    const sharesForbow = getSharesForBOW(filteredObj);
    const sharesIterator = sharesForbow[Symbol.iterator]();
    console.log('sharesIterator', sharesIterator);

    // Beneficiary Validation for BOW
    const benShareValidationBOW = Object.values(filteredObj).every(
      (value) => value === sharesIterator.next().value,
    );
    console.log('benShareValidationBOW', benShareValidationBOW);

    const getListType = () => {
      if (willTypeID === 3) return propertyList;
      if (willTypeID === 5) return accountList;
      if (willTypeID === 4) return companyShareInformationList;
      return null;
    };

    const list = getListType();
    console.log('listType', list);

    // Check property/account/company list length
    const propertySharesObject = filterByPropertyList(
      filteredObj,
      list,
      willTypeID,
    );
    console.log('propertySharesObject', propertySharesObject);
    // propertyList || accountList || companyShareInformationList

    // Check if all properties/accounts/companies are allocated shares
    let checkLength: boolean;
    if (
      (accountList.length
        || propertyList.length
        || companyShareInformationList.length)
      === Object.keys(propertySharesObject).length
    ) {
      // Add Company List when working on BOW
      checkLength = true;
    }

    // Allow submission only if the shares have been allocated
    if (updatedBen.length !== 0 && checkLength) {
      // Property Will && Financial Assets Will
      if (willTypeID === 5 || willTypeID === 3) {
        // Financial Assets Will && Property Will
        if (isSubPresent) {
          // IF  substitute is present check validation for beneficiaries & substitutes
          const checkSubLength = benCountList.length === Object.keys(removedZeros).length;
          // const checkSubLength = benCountList.length === subCount * accountList.length;
          console.log('checkSubLength', checkSubLength);

          // if (substituteSharesList.length !== 0) {
          // Check beneficiary && substitute validation here
          if (
            benShareValidation
            && subShareValidation
            && checkSubLength
            // && filteredLatestBenList.length !== 0
          ) {
            // dispatch<any>(submitshareDetails(updatedBen));
            dispatch<any>(
              submitshareDetails(
                isSpouseSelected ? spouseShares : husbandShares,
              ),
            );
            dispatch(setBySharesSubmitted(false));
            handleNext(6, 'by-specific', isCompleted);
          } else {
            await dispatch(resetErrorState());
            await dispatch(
              setErrorInfo('Please enter shares for all substitutes'),
            );
          }
          // }
        } else if (!isSubPresent) {
          // Working smoothly -- Beneficiary Validation working with single & multiple accounts/properties
          // Beneficiary validation only
          if (benShareValidation) {
            dispatch<any>(
              submitshareDetails(
                isSpouseSelected ? spouseShares : husbandShares,
              ),
            );
            dispatch(clearUpdatedBenList());
            dispatch(setBySharesSubmitted(false));
            handleNext(6, 'by-specific', isCompleted);
          } else {
            await dispatch(resetErrorState());
            await dispatch(
              setErrorInfo('Please enter shares for all beneficiaries'),
            );
          }
        }
      } else {
        // Buisness Owners Will
        if (!isSubPresent) {
          if (benShareValidationBOW) {
            dispatch<any>(
              submitshareDetails(
                isSpouseSelected ? spouseShares : husbandShares,
              ),
            );
            dispatch(setBySharesSubmitted(false));
            handleNext(6, 'by-specific', isCompleted);
          } else {
            await dispatch(resetErrorState());
            await dispatch(
              setErrorInfo('Please enter shares for all beneficiaries'),
            );
          }
        } else if (isSubPresent) {
          // Substitute is present
          console.log('Substitute Present');
          const checkSubLength = benCountList.length === Object.keys(removedZeros).length;
          if (
            benShareValidationBOW
            // && substituteValidationBOW
            && isSubstituteSharesValidBOW
            && checkSubLength
            // && filteredLatestBenList.length !== 0
          ) {
            dispatch<any>(
              submitshareDetails(
                isSpouseSelected ? spouseShares : husbandShares,
              ),
            );
            dispatch(setBySharesSubmitted(false));
            handleNext(6, 'by-specific', isCompleted);
          } else {
            await dispatch(resetErrorState());
            await dispatch(
              setErrorInfo('Please enter shares for all substitutes'),
            );
          }
        }
      }
    } else {
      await dispatch(resetErrorState());
      await dispatch(setErrorInfo('Please assign the shares'));
    }
    // -----
//Automatic Cart Update with AJAX on Header
add_filter( 'woocommerce_add_to_cart_fragments', 'iconic_cart_count_fragments', 10, 1 );
function iconic_cart_count_fragments( $fragments ) {    
    $fragments['div.header-cart-count'] = '<div class="header-cart-count">' . WC()->cart->get_cart_contents_count() . '</div>';
    return $fragments;
}
// ADD A SIZE CHART FOR SINGLE PRODUCT PAGE;
add_action( 'woocommerce_product_meta_start', 'custom_action_after_woocommerce_product_meta_start', 6 );
function custom_action_after_woocommerce_product_meta_start() { 
    
    echo '<div class="CustomOrders">';
        echo '<ul>';
            echo '<li>';
                echo '<div class="headingOrders">"Request a Quote for Bulk Quantity"</div>';
            echo '</li>';
            echo '<li>';
                echo '<a class="custom_popup" href="javascript:void(0)">Request a Qoute Form</a>';
            echo '</li>';
        echo '</ul>';
     echo '</div>';
} 
// ADD SWATCHES PRICE AFTER TITLE OF SINGLE PRODUCT;
function shuffle_variable_product_elements(){
    if ( is_product() ) {
        global $post;
        $product = wc_get_product( $post->ID );
        if ( $product->is_type( 'variable' ) ) {
            remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10 );
            add_action( 'woocommerce_before_variations_form', 'woocommerce_single_variation', 20 );

            // remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
            // add_action( 'woocommerce_before_variations_form', 'woocommerce_template_single_title', 10 );

            remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
            add_action( 'woocommerce_before_variations_form', 'woocommerce_template_single_excerpt', 30 );
        }
    }
}
add_action( 'woocommerce_before_single_product', 'shuffle_variable_product_elements' );
if(empty(prop("Date")), "0 - Pending", if(formatDate(now(), "L") == formatDate(prop("Date"), "L"), "3 - High Priority", if(now() > prop("Date"), "4 - ASAP", if(dateBetween(prop("Date"), now(), "days") > 7, "1 - Low Priority", "2 - Medium Priority"))))
https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_160833600356.html#Debugging-Deployed-SuiteScript-2.1-User-Event-Scripts
CREATE TEMPORARY TABLE temp_table AS (
  SELECT wp_postmeta.post_id, 
  	wp_postmeta.meta_value AS sale_price, 
  	pm1.meta_value AS regular_price,
  	pm2.meta_value AS price
  FROM wp_postmeta
  LEFT JOIN wp_postmeta pm1 ON pm1.post_id = wp_postmeta.post_id AND pm1.meta_key = '_regular_price'
  LEFT JOIN wp_postmeta pm2 ON pm2.post_id = wp_postmeta.post_id AND pm2.meta_key = '_price'
  WHERE wp_postmeta.meta_key = '_sale_price' AND wp_postmeta.meta_value IS NOT NULL AND wp_postmeta.meta_value <> '' 
);

UPDATE wp_postmeta pm1
INNER JOIN temp_table pm2 ON pm1.post_id = pm2.post_id
SET pm1.meta_value = pm2.sale_price
WHERE pm1.meta_key = '_price' 
AND pm2.price <> pm2.sale_price
-- AND pm1.post_id IN (5610)
;

DROP TEMPORARY TABLE temp_table;

-- select * from temp_table where price <> sale_price;
from pdf2image import convert_from_path
from PIL import Image
import os

def pdf_to_html_with_images(pdf_path):
    output_folder = os.path.dirname(pdf_path)
    images = convert_from_path(pdf_path)

    html_path = os.path.join(output_folder, 'output.html')
    
    with open(html_path, 'w', encoding='utf-8') as html_file:
        html_file.write('<!DOCTYPE html>\n<html>\n<body>\n')

        for i, image in enumerate(images):
            image_path = os.path.join(output_folder, f'image_{i}.png')
            image.save(image_path, 'PNG')
            html_file.write(f'<img src="{os.path.basename(image_path)}" alt="Image {i+1}"><br>\n')

        html_file.write('</body>\n</html>')

    return html_path

pdf_path = 'image-based-pdf-sample.pdf'  # Замените на путь к вашему PDF-файлу
generated_html = pdf_to_html_with_images(pdf_path)
print(f'HTML файл сохранен по пути: {generated_html}')
star

Fri Dec 08 2023 00:10:05 GMT+0000 (Coordinated Universal Time) https://copyprogramming.com/howto/start-sshd-automatically-with-docker-container

@lbarosi

star

Thu Dec 07 2023 23:18:13 GMT+0000 (Coordinated Universal Time) https://excalibur-craft.ru/

@Emphatic

star

Thu Dec 07 2023 23:17:27 GMT+0000 (Coordinated Universal Time) https://excalibur-craft.ru/

@Emphatic

star

Thu Dec 07 2023 18:08:42 GMT+0000 (Coordinated Universal Time) https://practice.geeksforgeeks.org/problems/linked-list-insertion-1587115620/1?page=1&category=Linked%20List&sortBy=submissions

@nistha_jnn #c++

star

Thu Dec 07 2023 16:37:05 GMT+0000 (Coordinated Universal Time) https://www.codingninjas.com/studio/problems/ninja-and-the-sorted-check_6581957?utm_source=youtube&utm_medium=affiliate&utm_campaign=striver_Arrayproblems&leftPanelTabValue=PROBLEM

@nistha_jnn #c++

star

Thu Dec 07 2023 13:23:33 GMT+0000 (Coordinated Universal Time) https://kundelik.kz/userfeed

@watashiva

star

Thu Dec 07 2023 12:36:50 GMT+0000 (Coordinated Universal Time) https://codingninjas.com/studio/problems/ninja-and-the-second-order-elements_6581960?utm_source=youtube&utm_medium=affiliate&utm_campaign=striver_Arrayproblems&leftPanelTabValue=PROBLEM

@nistha_jnn #c++

star

Thu Dec 07 2023 12:12:20 GMT+0000 (Coordinated Universal Time) https://bootsnipp.com/snippets/92e5X

@irfanelahi

star

Thu Dec 07 2023 09:51:21 GMT+0000 (Coordinated Universal Time) https://maticz.com/paxful-clone-script

@jamielucas #drupal

star

Thu Dec 07 2023 09:25:10 GMT+0000 (Coordinated Universal Time) https://www.ehansalytics.com/blog/2019/3/17/create-a-dynamic-date-table-in-power-query

@nikahafiz #ms.pbi #power.query #date #earliest.date #ms.excel

star

Thu Dec 07 2023 09:06:41 GMT+0000 (Coordinated Universal Time)

@irfanelahi

star

Thu Dec 07 2023 09:05:06 GMT+0000 (Coordinated Universal Time)

@irfanelahi

star

Thu Dec 07 2023 07:40:54 GMT+0000 (Coordinated Universal Time)

@Samarmhamed78

star

Thu Dec 07 2023 07:33:33 GMT+0000 (Coordinated Universal Time)

@Samarmhamed78

star

Thu Dec 07 2023 06:21:58 GMT+0000 (Coordinated Universal Time) https://www.cloudways.com/blog/live-search-laravel-ajax/

@zaryabmalik

star

Thu Dec 07 2023 02:18:47 GMT+0000 (Coordinated Universal Time) https://web.whatsapp.com/

@marcos

star

Wed Dec 06 2023 14:37:41 GMT+0000 (Coordinated Universal Time)

@ClemensBerteld #python #airflow

star

Wed Dec 06 2023 13:06:32 GMT+0000 (Coordinated Universal Time)

@shabih #vba

star

Wed Dec 06 2023 11:27:45 GMT+0000 (Coordinated Universal Time) https://joshcollinsworth.com/blog/never-use-px-for-font-size

@linabalciunaite

star

Wed Dec 06 2023 11:24:05 GMT+0000 (Coordinated Universal Time)

@Jeremicah

star

Wed Dec 06 2023 09:11:41 GMT+0000 (Coordinated Universal Time) https://proxy2.webshare.io/proxy/list?modals

@gainz_village

star

Wed Dec 06 2023 08:54:26 GMT+0000 (Coordinated Universal Time)

@KutasKozla #java

star

Wed Dec 06 2023 07:41:31 GMT+0000 (Coordinated Universal Time) https://analytics.google.com/analytics/web/

@santosbruna

star

Wed Dec 06 2023 07:35:14 GMT+0000 (Coordinated Universal Time) https://codepen.io/thinkdave/pen/rMzxBx

@irfanelahi

star

Wed Dec 06 2023 07:33:54 GMT+0000 (Coordinated Universal Time)

@irfanelahi ##custom

star

Wed Dec 06 2023 07:02:04 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/45033660/call-suitelet-from-user-event-ss-2

@mdfaizi #javascript

star

Tue Dec 05 2023 23:59:18 GMT+0000 (Coordinated Universal Time) https://community.spiceworks.com/topic/900079-how-to-merge-all-txt-files-into-one-using-type-and-insert-new-line-after-each

@baamn

star

Tue Dec 05 2023 23:07:59 GMT+0000 (Coordinated Universal Time)

@akshaypunhani #python

star

Tue Dec 05 2023 22:21:41 GMT+0000 (Coordinated Universal Time) https://www.online-tech-tips.com/free-software-downloads/combine-text-files/

@baamn #commandline

star

Tue Dec 05 2023 22:13:30 GMT+0000 (Coordinated Universal Time) https://superuser.com/questions/682001/combine-multiple-text-files-filenames-into-a-single-text-file

@baamn

star

Tue Dec 05 2023 22:10:11 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/40286458/combine-multiple-text-files-and-produce-a-new-single-text-file-using-powershell

@baamn

star

Tue Dec 05 2023 22:08:08 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/40286458/combine-multiple-text-files-and-produce-a-new-single-text-file-using-powershell

@baamn

star

Tue Dec 05 2023 22:07:28 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/40286458/combine-multiple-text-files-and-produce-a-new-single-text-file-using-powershell

@baamn

star

Tue Dec 05 2023 20:38:19 GMT+0000 (Coordinated Universal Time)

@bfpulliam #react.js

star

Tue Dec 05 2023 20:16:51 GMT+0000 (Coordinated Universal Time)

@Shuhab #bash

star

Tue Dec 05 2023 19:44:08 GMT+0000 (Coordinated Universal Time)

@Shuhab #bash

star

Tue Dec 05 2023 19:37:38 GMT+0000 (Coordinated Universal Time)

@Shuhab #bash

star

Tue Dec 05 2023 19:26:30 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #java

star

Tue Dec 05 2023 18:44:24 GMT+0000 (Coordinated Universal Time)

@vs #r

star

Tue Dec 05 2023 17:45:41 GMT+0000 (Coordinated Universal Time)

@rick_m #c#

star

Tue Dec 05 2023 15:06:28 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Dec 05 2023 15:04:02 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Dec 05 2023 15:03:36 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Dec 05 2023 13:57:53 GMT+0000 (Coordinated Universal Time) https://www.reddit.com/r/Notion/comments/rwpiki/changing_priority_level_based_on_date_formula/

@Hack3rmAn

star

Tue Dec 05 2023 13:46:29 GMT+0000 (Coordinated Universal Time)

@mdfaizi

star

Tue Dec 05 2023 12:57:29 GMT+0000 (Coordinated Universal Time)

@AlexP ##mysql ##woocommerce

star

Tue Dec 05 2023 11:20:42 GMT+0000 (Coordinated Universal Time)

@maltaellll

star

Tue Dec 05 2023 07:39:43 GMT+0000 (Coordinated Universal Time) https://codepen.io/jh3y/pen/XWOodoP

@passoul #css #scroll #animation

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension