Snippets Collections
import numpy as np
import matplotlib.pyplot as plt

# Constants for the equation
a = 100  # Example value for a
b = 1    # Example value for b
k = 2    # Example value for k

# Generate a range of x values
x_values = np.linspace(0, 10, 100)  # x will range from 0 to 10

# Calculate y values using the equation y = a - b * x^k
y_values = a - b * np.power(x_values, k)

# Create the plot
plt.figure(figsize=(8, 6))
plt.plot(x_values, y_values, label=f'y = {a} - {b} * x^{k}')

# Label the axes
plt.xlabel('x')
plt.ylabel('y')

# Add a title and legend
plt.title('Plot of the equation y = a - b * x^k')
plt.legend()

# Show the plot
plt.show()
import matplotlib.pyplot as plt
import numpy as np

# Defining the function g(t, c)
def g(t, c):
    return c / (t + 1)**2

# Generating a range of t values
t_values = np.linspace(1, 10, 400)  # t from 1 to 10

# Constant c value
c = 5

# Calculating y values using the function g(t, c)
y_values = g(t_values, c)

# Plotting the curve
plt.figure(figsize=(8, 6))
plt.plot(t_values, y_values, label=f'g(t, {c})')
plt.xlabel('t')
plt.ylabel('g(t, c)')
plt.title('Graph of a Decreasing and Convex Function g(t, c)')
plt.legend()
plt.grid(True)
plt.show()
import xarray as xr
from netCDF4 import Dataset
import h5py
import numpy as np
from multiprocessing import Pool
import s3fs
import time
import pandas as pd
import json
import os
import sys
import time
import subprocess as sp
import os


# Connect to AWS S3 storage
fs = s3fs.S3FileSystem(anon=True)
df = pd.read_csv("https://cmip6-pds.s3.amazonaws.com/pangeo-cmip6.csv")

proc = 40

def getData(query:dict):
    '''
    Load AWS CMIP6 data into xarray dataframe
    query (dict or str) - dict or str with data information
                        - if dict format as {'param':'value','param2':['val1','val2']}
    '''
    # Create query string for pandas.DataFrame.query
    if type(query) is dict:
        inputStr = " & ".join(["{0}=='{1}'".format(param, query[param]) for param in query])
    elif type(query) is str: # if its already a string, pass through
        inputStr=query

    # Searches cmip6 data csv for datasets that match given parameters
    df_subset = df.query(inputStr)
    if df_subset.empty:
        1+1
        print('data not available for '+inputStr)
    else:
        # load data
        for v in df_subset.zstore.values:
            zstore = v
            mapper = fs.get_mapper(zstore)
           
            ### open_zarr, so datasets are not loaded yet
            return_ds = xr.open_zarr(mapper, consolidated=True)
    return(return_ds)

def queryData(query:dict):
    '''
    query data availaibility
    '''
    # Create query string for pandas.DataFrame.query
    if type(query) is dict:
        inputStr = " & ".join(["{0}=='{1}'".format(param, query[param]) for param in query])
    elif type(query) is str: # if its already a string, pass through
        inputStr=query

    # Searches cmip6 data csv for datasets that match given parameters
    df_subset = df.query(inputStr)
    if df_subset.empty:
        #print('data is not available for '+inputStr)
        flag=False
    else:
        flag=True
    return(flag) 


modelList=['CESM2']

#modelList=[ 'ACCESS-ESM1-5', 'AWI-CM-1-1-MR', 'AWI-ESM-1-1-LR', 'BCC-CSM2-MR', 'BCC-ESM1', 'CAS-ESM2-0', 'CESM2', 'CESM2-FV2', 'CESM2-WACCM', 'CESM2-WACCM-FV2', 'CMCC-CM2-HR4', 'CMCC-CM2-SR5', 'CMCC-ESM2', 'CNRM-CM6-1', 'CNRM-CM6-1-HR', 'CNRM-ESM2-1',  'CanESM5-CanOE', 'E3SM-1-0', 'E3SM-1-1', 'E3SM-1-1-ECA', 'EC-Earth3', 'EC-Earth3-AerChem', 'EC-Earth3-Veg', 'EC-Earth3-Veg-LR', 'FGOALS-f3-L', 'FGOALS-g3', 'FIO-ESM-2-0', 'GFDL-CM4', 'GFDL-ESM4','GISS-E2-1-G-CC', 'HadGEM3-GC31-LL', 'HadGEM3-GC31-MM', 'IITM-ESM', 'INM-CM4-8', 'INM-CM5-0', 'IPSL-CM6A-LR', 'KACE-1-0-G', 'KIOST-ESM', 'MIROC-ES2L', 'MIROC6', 'MPI-ESM-1-2-HAM', 'MPI-ESM1-2-HR', 'MPI-ESM1-2-LR', 'MRI-ESM2-0', 'NESM3',  'NorESM2-MM', 'SAM0-UNICON', 'TaiESM1', 'UKESM1-0-LL']


experiment='historical'

table='SImon' ## 'Amon'

membList=['r1i1p1f1','r2i1p1f1','r3i1p1f1','r4i1p1f1','r5i1p1f1',
          'r6i1p1f1','r7i1p1f1','r8i1p1f1','r9i1p1f1','r10i1p1f1','r11i1p1f1']

#varList=['pr','rlut','rsdt','rsut']
varList=['siconca']


for model in modelList:
    #data = []
    dict_query = {'source_id':model,'table_id':table,'experiment_id':experiment}
    for var in varList:
        dict_query['variable_id'] = var
        for member in membList:
            dict_query['member_id'] = member 
            f=queryData(dict_query)
            #print(f)
            if f :
                print(var)
                data=getData(dict_query)
                membOut=member
                reData=regrid(data)
                #print(data)
                out_path= '/Data/{0}_{1}_{2}_siconca.nc'.format(model, membOut, experiment)
                reData.to_netcdf(path=out_path,mode='w',format='NETCDF4')
    
function get_w_params() {
  // Make a GET request and log the returned content.
  var response = UrlFetchApp.fetch('http://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/34');
  Logger.log(response.getContentText());
}
<?php 

add_filter( 'excerpt_length', 'custom_excerpt_length' , 999 ) ;
function custom_excerpt_length( $length ) {
return 20; // number of words. Default is 55.
}
import java.util.*;
import java.net.*;
import java.io.*;

public class Server {

    public static void main(String[] args) {

        for (String portStr : args) {
            try {
                int port = Integer.parseInt(portStr);
                new Thread(new ServerTask(port)).start();
            } catch (NumberFormatException e) {
                System.out.println("Incorrect port: " + portStr);
            }
        }
    }

    private static class ServerTask implements Runnable {
        private int port;

        public ServerTask(int port) {
            this.port = port;
        }

        public void run() {
            try (ServerSocket serverSocket = new ServerSocket(port)) {
                while (true) {
                    Socket clientSocket = serverSocket.accept();
                    new Thread(new ClientHandler(clientSocket)).start();
                }
            } catch (IOException e) {
                System.out.println("Error starting the server on port " + port);
            }
        }
    }

    private static class ClientHandler implements Runnable {
        private Socket clientSocket;

        public ClientHandler(Socket clientSocket) {
            this.clientSocket = clientSocket;
        }

        public void run() {
            try (InputStream input = clientSocket.getInputStream()) {
                byte[] buffer = new byte[20];
                int bytesRead = input.read(buffer);

                String receiveData = new String(buffer, 0, bytesRead);
                System.out.println(receiveData);
            } catch (IOException e) {
                System.out.println("Error receiving data from client");
                e.printStackTrace();
            } finally {
                try {
                    clientSocket.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
import java.util.*;
import java.net.*;
import java.io.*;
import util.SocketFactory;

class Main
{
    public static void main(String[] args) throws IOException
    {
        byte[] data  = new byte[20];
        String output = "";

        ServerSocket socket = SocketFactory.buildSocket();

        Socket clientSocket = socket.accept(); //oczekiwanie na polaczenie, oraz akceptacja

        InputStream input = clientSocket.getInputStream();
        
        input.read(data, 0, 20);
        output = new String(data, 0, 20);
        System.out.println(output);


    }
}
<div id=":5n" class="Am aiL IP Al editable Xp0HJf-LW-avf" hidefocus="true" aria-label="Signature" g_editable="true" role="textbox" aria-multiline="true" contenteditable="true" style="direction: ltr;"><br><table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr><td><table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr><td style="vertical-align:top"><table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr><td style="text-align:center"><img src="https://blazemedia.co.uk/wp-content/uploads/2023/04/paul.png" width="130" style="display:block;max-width:128px"></td></tr><tr><td height="30"></td></tr><tr><td style="text-align:center"><img src="https://blazemedia.co.uk/wp-content/themes/new-blaze/assets/images/logo/logo.png" width="130" style="display:block;max-width:130px"></td></tr><tr><td height="30"></td></tr><tr><td style="text-align:center"><table cellpadding="0" cellspacing="0" style="display:inline-block;vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr style="text-align:center"><td><a href="https://www.facebook.com/theblazemedia/" color="#E84B1E" style="display:inline-block;padding:0px;background-color:rgb(232,75,30)" target="_blank"><img src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/facebook-icon-2x.png" alt="facebook" color="#E84B1E" height="24" style="background-color:rgb(232,75,30);max-width:135px;display:block"></a></td><td width="5"><div></div></td><td><a href="https://www.linkedin.com/in/paul-webley-b745a421/" color="#E84B1E" style="display:inline-block;padding:0px;background-color:rgb(232,75,30)" target="_blank"><img src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/linkedin-icon-2x.png" alt="linkedin" color="#E84B1E" height="24" style="background-color:rgb(232,75,30);max-width:135px;display:block"></a></td><td width="5"><div></div></td><td><a href="https://www.instagram.com/theblazemedia/" color="#E84B1E" style="display:inline-block;padding:0px;background-color:rgb(232,75,30)" target="_blank"><img src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/instagram-icon-2x.png" alt="instagram" color="#E84B1E" height="24" style="background-color:rgb(232,75,30);max-width:135px;display:block"></a></td><td width="5"><div></div></td></tr></tbody></table></td></tr></tbody></table></td><td width="46"><div></div></td><td style="padding:0px;vertical-align:middle"><h2 color="#000000" style="margin:0px;font-size:18px;color:rgb(0,0,0);font-weight:600"><span>Paul</span><span>&nbsp;</span><span>Webley</span></h2><p color="#000000" style="margin:0px;color:rgb(0,0,0);font-size:14px;line-height:22px"><span>Managing Director</span></p><p color="#000000" style="margin:0px;font-weight:500;color:rgb(0,0,0);font-size:14px;line-height:22px"><span>Blaze Media</span></p><table cellpadding="0" cellspacing="0" style="width:100%;vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr><td height="30"></td></tr><tr><td color="#e84b1e" width="auto" height="1" style="width:100%;border-bottom:1px solid rgb(232,75,30);border-left:none;display:block"></td></tr><tr><td height="30"></td></tr></tbody></table><table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr height="25" style="vertical-align:middle"><td width="30" style="vertical-align:middle"><table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr><td style="vertical-align:bottom"><span color="#e84b1e" width="11" style="display:inline-block;background-color:rgb(232,75,30)"><img src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/phone-icon-2x.png" color="#e84b1e" alt="mobilePhone" width="13" style="display:block;background-color:rgb(232,75,30)"></span></td></tr></tbody></table></td><td style="padding:0px;color:rgb(0,0,0)"><a href="tel:01513193418" color="#000000" style="text-decoration:none;color:rgb(0,0,0);font-size:12px" target="_blank"><span>01513193418</span></a> | <a href="tel:07590539625" color="#000000" style="text-decoration:none;color:rgb(0,0,0);font-size:12px" target="_blank"><span>07590539625</span></a></td></tr><tr height="25" style="vertical-align:middle"><td width="30" style="vertical-align:middle"><table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr><td style="vertical-align:bottom"><span color="#e84b1e" width="11" style="display:inline-block;background-color:rgb(232,75,30)"><img src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/email-icon-2x.png" color="#e84b1e" alt="emailAddress" width="13" style="display:block;background-color:rgb(232,75,30)"></span></td></tr></tbody></table></td><td style="padding:0px"><a href="mailto:paul@blazemedia.co.uk" color="#000000" style="text-decoration:none;color:rgb(0,0,0);font-size:12px" target="_blank"><span>paul@blazemedia.co.uk</span></a></td></tr><tr height="25" style="vertical-align:middle"><td width="30" style="vertical-align:middle"><table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr><td style="vertical-align:bottom"><span color="#e84b1e" width="11" style="display:inline-block;background-color:rgb(232,75,30)"><img src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/link-icon-2x.png" color="#e84b1e" alt="website" width="13" style="display:block;background-color:rgb(232,75,30)"></span></td></tr></tbody></table></td><td style="padding:0px"><a href="//blazemedia.co.uk" color="#000000" style="text-decoration:none;color:rgb(0,0,0);font-size:12px" target="_blank"><span>blazemedia.co.uk</span></a></td></tr><tr height="25" style="vertical-align:middle"><td width="30" style="vertical-align:middle"><table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr><td style="vertical-align:bottom"><span color="#e84b1e" width="11" style="display:inline-block;background-color:rgb(232,75,30)"><img src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/address-icon-2x.png" color="#e84b1e" alt="address" width="13" style="display:block;background-color:rgb(232,75,30)"></span></td></tr></tbody></table></td><td style="padding:0px"><span color="#000000" style="font-size:12px;color:rgb(0,0,0)"><span>Blaze Media, Studio P, Baltic Creative Digital House, 44 Simpson Street, L1 0AX</span></span></td></tr></tbody></table><table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-size:medium;font-family:Arial"><tbody><tr><td height="30"></td></tr></tbody></table><span style="display:block;text-align:left"><a rel="noopener noreferrer" href="https://blazemedia.us1.list-manage.com/subscribe?u=ec8f90de32d9258aee021edb0&amp;id=a2935a0c0f" color="#e84b1e" style="border-width:6px 12px;border-style:solid;border-color:rgb(232,75,30);display:inline-block;background-color:rgb(232,75,30);color:rgb(255,255,255);font-weight:700;text-decoration:none;text-align:center;line-height:40px;font-size:12px;border-radius:3px" target="_blank">Subscribe to our newsletter</a></span></td></tr></tbody></table></td></tr></tbody></table></div>
import java.util.*;
import java.net.*;
import java.io.*;

class Sock{
    public static String getFlag(String hostName, Integer port){
        int bufferSize = 20;
        byte[] data = new byte[bufferSize];
        String output = "";

        try{
            Socket socket = new Socket(hostName, port);
            for(int i = 0; i < bufferSize; i++){
                if(socket.getInputStream().read(data, i, 1) <= 0){
                    break;
                }
            //socket.getInputStream().read(data, i, 1); //0 to indeks gdzie zaczynay,
            output = output + (char) data[i]; 
            }
            socket.close();
        }
        catch(IOException e){
            System.out.println(e);
        }

        return output;
    }
}

class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        Integer port = scan.nextInt();

        System.out.println(Sock.getFlag("127.0.0.1", port)); //wyprintuje SUCCESS

    }
}
  = ;
int y = 10;
printf("%d", x + y);

int () {
  ("Hello World!");
  return 0;
}
<script setup lang="ts">
import { shallowRef } from 'vue';
import { RouterLink } from 'vue-router';
import IconAngle from './icons/IconAngle.vue';
import IconEmail from './icons/IconEmail.vue';
import IconEmployeeGroup from './icons/IconEmployeeGroup.vue';
import IconExclamation from './icons/IconExclamation.vue';
import IconHome from './icons/IconHome.vue';

const isSidebarOpen = shallowRef<Boolean>(false)

function toggleSidebar() {
  isSidebarOpen.value = !isSidebarOpen.value;
}

</script>

<template>
  <div class="wrapper">
    <aside :vue:is-open="isSidebarOpen">
      <ul class="sidebar-head">
        <li>
          <img src="@/assets/logo.png" alt="logo" width="32" height="32">
        </li>
        <li>
          <button class="sidebar-toggle" :class="isSidebarOpen ? 'toggle-button' : ''">
            <IconAngle @click="toggleSidebar" />
          </button>
        </li>
      </ul>

      <h4 :transparent="!isSidebarOpen">Menu</h4>

      <ul>
        <li>
          <router-link to="/">
            <IconHome />
            <Transition name="fade">
              <span v-show="isSidebarOpen">Home</span>
            </Transition>
          </router-link>
        </li>
        <li>
          <router-link to="/about">
            <IconExclamation />
            <Transition name="fade">
              <span v-show="isSidebarOpen">About</span>
            </Transition>
          </router-link>
        </li>
        <li>
          <router-link to="/team">
            <IconEmployeeGroup />
            <Transition name="fade">
              <span v-show="isSidebarOpen">Team</span>
            </Transition>
          </router-link>
        </li>
        <li>
          <router-link to="/contact">
            <IconEmail />
            <Transition name="fade">
              <span v-show="isSidebarOpen">Contact</span>
            </Transition>
          </router-link>
        </li>
      </ul>
    </aside>
  </div>
</template>

<style scoped lang="scss">
@use '@/assets/scss/colors' as clr;

$sidebar-width: 4rem;
$toggle-duration: 300ms;
$sidebar-padding-inline-start: 1rem;

aside {
  color: clr.$primary;
  background: clr.$bg-dark;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-block: 1rem;
  transition: all $toggle-duration;
  width: $sidebar-width;
}

aside[vue\:is-open=true] {
  width: 3 * $sidebar-width;
}

ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-block-end: 1rem;
}

img {
  object-fit: contain;
}

li {
  min-width: fit-content;
  cursor: pointer;
  padding-inline-start: $sidebar-padding-inline-start;

  &:hover {
    color: clr.$secondary;
    background-color: lighten($color: clr.$bg-dark, $amount: 5);
  }

  & a {
    // border-right: 0.25rem solid white;
    display: flex;
    align-items: center;
    column-gap: 0.75rem;
    position: relative;
    padding-block: 0.5rem;
  }

  a.router-link-exact-active::after {
    content: '';
    position: absolute;
    right: 0;
    width: 0.25rem;
    height: 100%;
    background-color: clr.$secondary;
  }
}
.sidebar-head {
  position: relative;
  // padding-block-end: 4rem;
}

.sidebar-toggle {
  padding-inline-start: $sidebar-padding-inline-start;
}

h4 {
  padding-block-end: 1rem;
  padding-inline-start: $sidebar-padding-inline-start;
  user-select: none;
  pointer-events: none;
  opacity: 0.5;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.125ch;
  transition: opacity $toggle-duration;
}

h4[transparent=true] {
  opacity: 0;
}

button {
  cursor: pointer;
  position: absolute;
  transition-duration: $toggle-duration;
  transition-property: transform, left, top;
  left: 0;
  top: 1rem;
  transform: translateX(0%) translateY(2rem) rotateZ(0deg);

  &.toggle-button {
    left: 100%;
    top: 0;
    transform: translateX(-100%) translateY(0rem) rotateZ(180deg);
  }
}

.fade-enter-active,
.fade-leave-active {
  transition-property: opacity, transform;
  transition-duration: $toggle-duration;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
  transform: translateX(-100%);
}
</style>
import { onMounted, onUnmounted, ref } from 'vue'

function useScreenOrientation() {
  const portrait = window.matchMedia('(orientation: portrait)')
  const orientation = ref(portrait.matches ? 'portrait' : 'landscape')

  function orientationListener(e: MediaQueryListEvent) {
    orientation.value = e.matches ? 'portrait' : 'landscape'
  }

  onMounted(() => {
    portrait.addEventListener('change', orientationListener)
  })

  onUnmounted(() => {
    portrait.removeEventListener('change', orientationListener)
  })

  return orientation
}

export {
  useScreenOrientation,
  useScreenOrientation as default,
}
<template>
  <div
    :style="styleGeneral"
    aria-label="container-scroll"
    :class="`container ${this.scroll ? 'containerScroll' : ''}`"
  >
    <div
      aria-label="subcontainer-scroll"
      ref="component"
      class="subcontainer"
      :style="styleSubcontainer"
    >
      <slot />
    </div>
  </div>
</template>

<script>
import ResizeObserver from 'resize-observer-polyfill';

export default {
  name: 'ScrollShadow',
  data() {
    let styleGeneral = this.styleContainer;
    styleGeneral += `--scrollColor:${this.scrollColor};`;
    styleGeneral += `--shadow:${this.isShadow ? this.shadow : ''};`;
    styleGeneral += `--scrollPadding:${this.scrollPadding};`;
    styleGeneral += `--scrollWidth:${this.scrollWidth};`;
    styleGeneral += `--scrollColorHover:${this.scrollColorHover}`;

    return {
      scroll: false,
      component: null,
      RO: null,
      styleGeneral,
      classGeneral: 'container'
    };
  },
  props: {
    styleContainer: { type: String, default: '' },
    styleSubcontainer: { type: String, default: '' },
    // Scroll color
    scrollColor: { type: String, default: '#c5c5c5' },
    // Left scroll padding
    scrollPadding: { type: String, default: '0px' },
    // Scroll Width
    scrollWidth: { type: String, default: '8px' },
    // Scroll color when hover
    scrollColorHover: { type: String, default: '#a6a6a6' },
    shadow: {
      type: String,
      default:
        '0 2px 4px rgba(0, 0, 0, 0.2) inset, 0 -2px 4px rgba(0, 0, 0, 0.2) inset'
    },
    // Verify shadow is visible
    isShadow: { type: Boolean, default: true }
  },
  mounted() {
    const refComponent = this.$refs.component;

    const RO = new ResizeObserver(() => {
      if (refComponent.clientHeight < refComponent.scrollHeight) {
        this.scroll = true;
      } else {
        this.scroll = false;
      }
    });

    RO.observe(refComponent);
  }
};
</script>

<style scoped>
.containerScroll {
  box-shadow: var(--shadow);
}
.container {
  width: 100%;
  overflow-y: hidden;
  box-sizing: border-box;
  display: flex;
}
.subcontainer {
  padding-right: var(--scrollPadding);
  overflow-y: auto;
  flex: 1;
  scrollbar-color: var(--scrollColor);
  scrollbar-width: thin;
}
.subcontainer::-webkit-scrollbar {
  width: var(--scrollWidth);
  background: transparent;
}
.subcontainer::-webkit-scrollbar-track {
  background: 'transparent';
}
.subcontainer::-webkit-scrollbar-thumb {
  background: var(--scrollColor);
  border-radius: 5px;
  overflow: hidden;
}
.subcontainer::-webkit-scrollbar-thumb:hover {
  background: var(--scrollColorHover);
}
</style>
 Save
def main():
    sitemap_urls = get_urls_from_sitemap(
        'https://site.tld/sitemap.xml')
    print(sitemap_urls)


if __name__ == '__main__':
    main()
def get_urls_from_sitemap(sitemap_url=None):
    sitemap = get_sitemap_from_url(sitemap_url)
    if sitemap is None:
        return None
    document = parseString(sitemap)
    locations = document.getElementsByTagName('loc')
    urls = []
    for location in locations:
        urls.append(location.firstChild.nodeValue)
    return urls
import requests
from xml.dom.minidom import parseString


def get_sitemap_from_url(sitemap_url=None):
    if sitemap_url is None:
        return None
    try:
        response = requests.get(sitemap_url, allow_redirects=True)
        return response.text
    except requests.exceptions.RequestException:
        return None
import java.util.*;
import java.net.*;
import java.io.*;

class Sock{
    public static String getFlag(String hostName, Integer port){
        byte[] data = new byte[20];
        try{
            Socket socket = new Socket(hostName, port);
            socket.getInputStream().read(data, 0, 20); //0 to indeks gdzie zaczynay,
            socket.close();
        }
        catch(IOException e){
            System.out.println(e);
        }

        return new String(data, 0, 20);
    }
}

class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        Integer port = scan.nextInt();

        System.out.println(Sock.getFlag("127.0.0.1", port)); //wyprintuje SUCCESS

    }
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    /* Overlay styling */
    #overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.5); /* More transparent background */
      z-index: 1;
    }

    /* Popup container styling */
    #popup-container {
      display: none;
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      padding: 20px;
      z-index: 2;
      border-radius: 10px; /* Rounded corners */
      background-color: #fff; /* White background */
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Box shadow for depth */
    }

    /* Close button styling */
    #close-button {
      color: #000;
      background-color: transparent;
      position: absolute;
      font-size: 18px;
      right: 15px;
      top: 15px;
      cursor: pointer;
      z-index: 3;
    }

    /* Form styles */
    #popup-form {
      text-align: center;
    }

    /* Additional styles for form elements */
    #form-heading {
      font-size: 48px;
      color: #bc1d29;
      margin-bottom: 10px;
    }

    #form-subheading {
      font-size: 16px;
      margin-bottom: 20px;
      font-weight: bold;
    }

    #form-text {
      font-size: 12px;
      margin-bottom: 20px;
    }

    #voucher-input {
      width: 100%;
      padding: 10px;
      margin-bottom: 20px;
      box-sizing: border-box;
    }

    #getVoucherBtn {
      padding: 14px;
      margin: 5px;
      cursor: pointer;
      background-color: #bc1d29;
      color: #fff;
      font-size: 14px;
      font-weight: bold;
      border: none;
      width: 100%;
    }

    #noThanksBtn {
      padding: 14px;
      margin: 5px;
      cursor: pointer;
      background-color: #ccc;
      color: #000;
      font-size: 14px;
      font-weight: bold;
      border: none;
      width: 100%;
    }

    /* Show-popup container styling */
    #show-popup-container {
      position: fixed;
      bottom: 140px;
      left: 20px;
      z-index: 4; /* Ensure the button is above the popup */
    }

    /* Show-popup button styling */
    #show-popup {
      cursor: pointer;
      width: auto;
      height: 60px;
      background-color: #bc1d29;
      color: #fff;
      font-size: 18px;
      font-weight: bold;
      border: none;
      border-radius: 0;
      transform: rotate(270deg);
      transform-origin: left center;
    }

    #show-popup:hover {
      background-color: #a0141f; /* Darker color on hover */
    }

    /* Responsive styles 912px */
    @media (max-width: 840px) {
      #popup-container {
        padding: 40px; /* Adjust padding for smaller screens */
        top: 55%; /* Center vertically */
        left: 38%;
        transform: translate(-50%, -50%); /* Center the container */
      }

      #show-popup-container {
        bottom: 170px; /* Adjust top position for smaller screens */
        left: 29px; /* Adjust left position for smaller screens */
      }

      #show-popup {
        font-size: 29px; /* Adjust font size for smaller screens */
        background-color: #bc1d29;
      }

      #show-popup:hover {
        background-color: #a0141f; /* Darker color on hover */
      }
    }

    /* Responsive styles 790px */
    @media only screen and (max-width: 790px) {
      #popup-container {
        padding: 10px; /* Adjust padding for smaller screens */
        top: 55%; /* Center vertically */
        left: 40%;
        transform: translate(-50%, -50%); /* Center the container */
      }

      #show-popup-container {
        bottom: 130px; /* Adjust top position for smaller screens */
        left: 22px; /* Adjust left position for smaller screens */
      }

      #show-popup {
        font-size: 23px; /* Adjust font size for smaller screens */
        background-color: #bc1d29;
        position: fixed; /* Add this line to fix the button position */
      }

      #show-popup:hover {
        background-color: #a0141f; /* Darker color on hover */
      }
    }

    /* Responsive styles 430px */
    @media (max-width: 430px) {
      #popup-container {
        padding: 10px; /* Adjust padding for smaller screens */
        top: 60%; /* Center vertically */
        left: 57%;
        transform: translate(-50%, -65%); /* Center the container */
		z-index:1;  
      }

      #show-popup-container {
        bottom: 150px; /* Adjust top position for smaller screens */
        left: 20px; /* Adjust left position for smaller screens */
      }

      #show-popup {
        font-size: 18px; /* Adjust font size for smaller screens */
        background-color: #bc1d29;
      }

      #show-popup:hover {
        background-color: #a0141f; /* Darker color on hover */
      }

      /* Additional styles for form elements in the media query */
      #popup-form {
        text-align: center;
        box-sizing: content-box;
        margin-right: 10px;
      }

      #form-heading {
        font-size: 38px;
        color: #bc1d29;
        margin-bottom: 10px;
      }

      #form-subheading {
        font-size: 14px;
        margin-bottom: 20px;
        font-weight: bold;
      }

      #form-text {
        font-size: 12px;
        margin-bottom: 20px;
      }

      #voucher-input {
        width: 100%;
        padding: 10px;
        margin-bottom: 20px;
        box-sizing: border-box;
      }

      #getVoucherBtn {
        padding: 14px;
        margin: 5px;
        cursor: pointer;
        background-color: #bc1d29;
        color: #fff;
        font-size: 14px;
        font-weight: bold;
        border: none;
        width: 100%;
      }

      #noThanksBtn {
        padding: 14px;
        margin: 5px;
        cursor: pointer;
        background-color: #ccc;
        color: #000;
        font-size: 14px;
        font-weight: bold;
        border: none;
        width: 100%;
      }
    }
  </style>
</head>

<body>

  <div id="show-popup-container">
    <button id="show-popup" onclick="togglePopup()">GET $6 COUPON </button>
  </div>

  <div id="overlay" onclick="closePopup()"></div>

  <div id="popup-container">
    <div id="close-button" onclick="closePopup()">X</div>

    <!-- Form content -->
    <div id="popup-form">
      <h1 id="form-heading">First-time here?</h1>
      <p id="form-subheading">Sign up now and get RM5 OFF your first purchase</p>
      <input type="text" id="voucher-input" placeholder="Email Address">
      <button id="getVoucherBtn" onclick="getVoucher()">Get Your Voucher Code Now</button>
      <button id="noThanksBtn" onclick="closePopup()">No Thanks</button>
      <p id="form-text">You are signing up to receive communication via email and can unsubscribe at any time</p>
    </div>
  </div>

  <script>
    function togglePopup() {
      document.getElementById("overlay").style.display = "block";
      document.getElementById("popup-container").style.display = "block";
    }

    function closePopup() {
      document.getElementById("overlay").style.display = "none";
      document.getElementById("popup-container").style.display = "none";
    }

    function getVoucher() {
      // Signup link
      var voucherLink = "https://account.easyparcel.com/register?client_id=c575e8cd-aa46-46db-8308-e18d25bb76c6&redirect_uri=https%3A%2F%2Fapp.easyparcel.com%2Feasyaccount%2Fcallback&state=eyJjbGllbnRfaWQiOiI1M2FmYmQzMS05OGI2LTQ3ODctOWYzOC1kMDY5ZGRkN2RiM2QiLCJyZWRpcmVjdF91cmkiOiJodHRwczovL2FwcC5lYXN5cGFyY2VsLmNvbS9sb2dpbi9vYXV0aC9jYWxsYmFjayIsInN0YXRlIjoie1wicmVmZXJyZXJfY29kZVwiOlwiZDVhZmIyM2RkNTY5MWNiYjAzNDMwMTU5Y2UzODNjZjFRWGd4RDIyOEJIdWt6WUxwZDc5eElnPT1cIn0iLCJjb3VudHJ5IjoibXkiLCJsYW5nIjoiZW4ifQ%3D%3D&country=my";

      // Open the link in a new tab
      window.open(voucherLink, '_blank');

      // Close the form popup after handling the click
      closePopup();
    }
  </script>

</body>

</html>
#include<iostream>
using namespace std;

int main() {
    int cases;
    cout << "Enter no of Cases:";
    cin >> cases;

    for (int caseNumber = 1; caseNumber <= cases; caseNumber++) {
        cout << "Enter the size of matrix:";
        int n, count = 0;
        cin >> n;
        int arr1[n][n];
        int arr2[n][n];

        cout << "Enter Matrix A" << endl;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                cout << "Enter element of matrix A:";
                cin >> arr1[i][j];
            }
        }

        cout << "Enter Matrix B :" << endl;
        for (int m = 0; m < n; m++) {
            for (int o = 0; o < n; o++) {
                cout << "Enter element of matrix B:";
                cin >> arr2[m][o];
            }
        }

        bool possible = true;

        for (int x = 0; x < n; x++) {
            for (int y = 0; y < n; y++) {
                if (arr1[x][y] != arr2[x][y]) {
                    arr1[x][y] = arr2[x][y];
                    count++;
                    cout<<"caught symmetrisizm  ";
                }
            }
        }

        // Check if the matrix can be converted and is not symmetric
        for(int i=0;i<n;++i){
             for(int j=0;j<n;++j){
                if(i+j!=0 && i!=j){
                    if(arr1[i][j]==arr2[j][i]){
                      cout<<"Symmetrism"<<endl;
                      count++;  
                    }
                }
             }
        }
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (arr1[i][j] == arr1[j][i]) {
                    possible = false;
                    break;
                }
            }
            if (!possible) {
                break;
            }
        }

        if (possible) {
            cout << "Matrix A is Converted into B as  :" << endl;
            for (int a = 0; a < n; a++) {
                for (int b = 0; b < n; b++) {
                    cout << arr1[a][b] << " ";
                }
                cout << endl;
            }
            cout << "Case " << caseNumber << ": " << count << endl;
        } else {
            cout << "Case " << caseNumber << ": -1 (Conversion is not possible while obeying the rules.)" << endl;
        }
    }

    return 0;
}
https://prnt.sc/xfcNBdvSewps

add_filter('wpspro_permalink_structure_default', '__return_false' );
#include <iostream>

using namespace std;

const int Msize = 500;

void findAndReplace(char inputText[], const char targetWord[], const char replacementWord[]) {
    int position = 0;
    int targetLength = 0;
    int replacementLength = 0;

    while (inputText[position] != '\0') {
        position++;
    }

    while (targetWord[targetLength] != '\0') {
        targetLen++;
    }

    while (replacementWord[replacementLength] != '\0') {
        replacementLength++;
    }

    for (int i = 0; i < position; ++i) {
        bool found = true;
        for (int j = 0; j < targetLength; ++j) {
            if (inputText[i + j] != targetWord[j]) {
                found = false;
                break;
            }
        }

        if (found) {
            for (int j = 0; j < replacementLength; ++j) {
                inputText[i + j] = replacementWord[j];
            }
            i += replacementLength - 1;
        }
    }
}

int main() {
    char text[Msize + 1];
    char findWord[Msize];
    char replaceWord[Msize];

    // Input text
    cout << "Please enter the text (500 chars max):" << endl;
    cin.getline(text, Msize + 1);

    while (true) {
        // Input word to find
        cout << "Please enter the word to find (or enter an empty word to exit):" << endl;
        cin.getline(findWord, Msize);

        // Check for exit condition
        if (findWord[0] == '\0') {
            break;
        }

        // Input word to replace
        cout << "Please enter the replace word:" << endl;
        cin.getline(replaceWord, Msize);

        // Find and replace
        findAndReplace(text, findWord, replaceWord);

        // Display result
        cout << "Result:" << endl;
        cout << text << endl;
    }

    return 0;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    /* Overlay styling */
    #overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.5); /* More transparent background */
      z-index: 1;
    }

    /* Popup container styling */
    #popup-container {
      display: none;
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      padding: 20px;
      z-index: 2;
      border-radius: 0px; /* Rounded corners */
    }

    /* Close button styling */
    #close-button {
      color: #F9278E;
      background-color: transparent;
      position: absolute;
      font-size: 30px;
      right: 15px;
      top: 15px;
      cursor: pointer;
      z-index: 3;
    }

    /* Popup image styling */
    #popup-img {
      max-width: 100%;
      max-height: 70vh;
      border-radius: 8px; /* Rounded corners for the image */
      border: 1px solid transparent; /* Transparent border */
    }

    /* Show-popup container styling */
    #show-popup-container {
      position: fixed;
      bottom: 140px;
      left: 20px;
      z-index: 4; /* Ensure the button is above the popup */
    }

    /* Show-popup button styling */
    #show-popup {
      cursor: pointer;
      width: auto;
      height: 60px;
      background-color: #bc1d29;
      color: #fff;
      font-size: 18px;
      font-weight: bold;
      border: none;
      border-radius: 0;
      transform: rotate(270deg);
      transform-origin: left center;
    }

    #show-popup:hover {
      background-color: #a0141f; /* Darker color on hover */
    }

     /* Responsive 912 */
 @media(max-width:840px){
	#popup-container {
padding: 40px; /* Adjust padding for smaller screens */
top: 55%; /* Center vertically */
left: 38%; 
transform: translate(-50%, -50%); /* Center the container */
}

#show-popup-container {
bottom: 170px; /* Adjust top position for smaller screens */
left: 29px; /* Adjust left position for smaller screens */
}

#show-popup {
font-size: 29px; /* Adjust font size for smaller screens */
background-color: #bc1d29;
}

#show-popup:hover {
  background-color: #a0141f; /* Darker color on hover */
}

#popup-img {
max-width: 160%; /* Adjust the width of the image */
max-height: 60vh;
border-radius: 10px; /* Rounded corners for the image */
border: 2px solid transparent; /* Transparent border */
}

#close-button {
font-size: 40px;
left: 650px; /* Adjust right position for smaller screens */
top: 2px; /* Adjust top position for smaller screens */
}
	}

    /* Responsive styles 790px */
/* Responsive styles 790px */
@media only screen and (max-width: 790px) {
  #popup-container {
    padding: 10px; /* Adjust padding for smaller screens */
    top: 55%; /* Center vertically */
    left: 40%;
    transform: translate(-50%, -50%); /* Center the container */
  }

  #show-popup-container {
    bottom: 130px; /* Adjust top position for smaller screens */
    left: 22px; /* Adjust left position for smaller screens */
  }

  #show-popup {
    font-size: 23px; /* Adjust font size for smaller screens */
    background-color: #bc1d29;
    position: fixed; /* Add this line to fix the button position */
  }

  #show-popup:hover {
    background-color: #a0141f; /* Darker color on hover */
  }

  #popup-img {
    max-width: 140%; /* Adjust the width of the image */
    max-height: 60vh;
    border-radius: 10px; /* Rounded corners for the image */
    border: 2px solid transparent; /* Transparent border */
  }

  #close-button {
    font-size: 28px;
    left: 570px; /* Adjust right position for smaller screens */
    top: 1px; /* Adjust top position for smaller screens */
  }
}

 /* Responsive styles 430px */
@media(max-width:430px) {
    #popup-container {
    padding: 10px; /* Adjust padding for smaller screens */
    top: 45%; /* Center vertically */
    left: 40%; 
    transform: translate(-50%, -50%); /* Center the container */
  }

  #show-popup-container {
    bottom: 150px; /* Adjust top position for smaller screens */
    left: 20px; /* Adjust left position for smaller screens */
  }

  #show-popup {
    font-size: 18px; /* Adjust font size for smaller screens */
    background-color: #bc1d29;
  }

  #show-popup:hover {
      background-color: #a0141f; /* Darker color on hover */
    }

  #popup-img {
    max-width: 140%; /* Adjust the width of the image */
    max-height: 60vh;
    border-radius: 10px; /* Rounded corners for the image */
    border: 2px solid transparent; /* Transparent border */
  }

  #close-button {
    font-size: 18px;
    left: 290px; /* Adjust right position for smaller screens */
    bottom: 5px; /* Adjust top position for smaller screens */
  }
}
  </style>
</head>

<body>

  <div id="show-popup-container">
    <button id="show-popup" onclick="togglePopup()">GET $6 COUPON </button>
  </div>

  <div id="overlay" onclick="closePopup()"></div>

  <div id="popup-container">
    <div id="close-button" onclick="closePopup()">X</div>
    <img id="popup-img" src="https://ep-website-media.s3.ap-southeast-1.amazonaws.com/sg/wp-content/uploads/2023/05/SG-Get-Free-S6-Coupon-Signup-popup.png" alt="Popup Image">
  </div>

  <script>
    function togglePopup() {
      document.getElementById("overlay").style.display = "block";
      document.getElementById("popup-container").style.display = "block";
    }

    function closePopup() {
      document.getElementById("overlay").style.display = "none";
      document.getElementById("popup-container").style.display = "none";
    }
  </script>

</body>

</html>
#include <LiquidCrystal.h>

const int butpin = 8;
int buttonState = HIGH;
int lastbuttonState = HIGH;
unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 50;
int butVal;
int pressCounter = 0;
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup(){

  pinMode(8, INPUT);

  lcd.begin(16, 2);
  Serial.begin(9600);

}

void loop(){

  butVal = digitalRead(butpin);

  if(butVal != lastbuttonState){

    lastDebounceTime = millis();

  }

  if((millis() - lastDebounceTime) > debounceDelay){

    if(butVal != buttonState){
      buttonState = butVal;

      if(buttonState == HIGH){
       pressCounter++;
     }
    }
    
       lcd.setCursor(0, 0);        
       lcd.print("Steps: ");
       lcd.print(pressCounter);
    
  }
  
  lastbuttonState = butVal;


}
<!DOCTYPE html>
<html>
  <head>
      <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
      <title>Spring Boot WebSocket Chat Application | CalliCoder</title>
      <link rel="stylesheet" href="css/main.css" />
  </head>
  <body>
    <noscript>
      <h2>Sorry! Your browser doesn't support Javascript</h2>
    </noscript>

    <div id="username-page">
        <div class="username-page-container">
            <h1 class="title">Type your username</h1>
            <form id="usernameForm" name="usernameForm">
                <div class="form-group">
                    <input type="text" id="name" placeholder="Username" autocomplete="off" class="form-control" />
                </div>
                <div class="form-group">
                    <button type="submit" class="accent username-submit">Start Chatting</button>
                </div>
            </form>
        </div>
    </div>

    <div id="chat-page" class="hidden">
        <div class="chat-container">
            <div class="chat-header">
                <h2>Spring WebSocket Chat Demo</h2>
            </div>
            <div class="connecting">
                Connecting...
            </div>
            <ul id="messageArea">

            </ul>
            <form id="messageForm" name="messageForm" nameForm="messageForm">
                <div class="form-group">
                    <div class="input-group clearfix">
                        <input type="text" id="message" placeholder="Type a message..." autocomplete="off" class="form-control"/>
                        <button type="submit" class="primary">Send</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/sockjs-client/1.1.4/sockjs.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/stomp.js/2.3.3/stomp.min.js"></script>
    <script src="js/main.js"></script>
  </body>
</html>

------------------------------------
pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.example</groupId>
	<artifactId>websocket-demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>websocket-demo</name>
	<description>Spring Boot WebSocket Chat Demo</description>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.5.5</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>11</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-websocket</artifactId>
		</dependency>

		<!-- RabbitMQ Starter Dependency (Not required if you're using the simple in-memory broker for STOMP) -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-amqp</artifactId>
		</dependency>

		<!-- Following dependency is required for Full Featured STOMP Broker Relay -->
		<dependency>
		    <groupId>org.springframework.boot</groupId>
		    <artifactId>spring-boot-starter-reactor-netty</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
			<!-- This plugin is used to create a docker image and publish the image to docker hub-->
			<plugin>
				<groupId>com.spotify</groupId>
				<artifactId>dockerfile-maven-plugin</artifactId>
				<version>1.4.0</version>
				<configuration>
					<!-- replace `callicoder` with your docker id-->
					<repository>callicoder/spring-boot-websocket-chat-demo</repository>
					<tag>${project.version}</tag>
					<buildArgs>
						<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
					</buildArgs>
				</configuration>
				<executions>
					<execution>
						<id>default</id>
						<phase>install</phase>
						<goals>
							<goal>build</goal>
							<goal>push</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>
--------------------------------------

static/js/main.js

'use strict';

var usernamePage = document.querySelector('#username-page');
var chatPage = document.querySelector('#chat-page');
var usernameForm = document.querySelector('#usernameForm');
var messageForm = document.querySelector('#messageForm');
var messageInput = document.querySelector('#message');
var messageArea = document.querySelector('#messageArea');
var connectingElement = document.querySelector('.connecting');

var stompClient = null;
var username = null;

var colors = [
    '#2196F3', '#32c787', '#00BCD4', '#ff5652',
    '#ffc107', '#ff85af', '#FF9800', '#39bbb0'
];

function connect(event) {
    username = document.querySelector('#name').value.trim();

    if(username) {
        usernamePage.classList.add('hidden');
        chatPage.classList.remove('hidden');

        var socket = new SockJS('/ws');
        stompClient = Stomp.over(socket);

        stompClient.connect({}, onConnected, onError);
    }
    event.preventDefault();
}

function onConnected() {
    // Subscribe to the Public Topic
    stompClient.subscribe('/topic/public', onMessageReceived);

    // Tell your username to the server
    stompClient.send("/app/chat.addUser",
        {},
        JSON.stringify({sender: username, type: 'JOIN'})
    )

    connectingElement.classList.add('hidden');
}


function onError(error) {
    connectingElement.textContent = 'Could not connect to WebSocket server. Please refresh this page to try again!';
    connectingElement.style.color = 'red';
}


async function sendMessage(event) {
    var messageContent = messageInput.value.trim();

    if(messageContent && stompClient) {
        var chatMessage = {
            sender: username,
            content: messageInput.value,
            type: 'CHAT'
        };

        stompClient.send("/app/chat.sendMessage", {}, JSON.stringify(chatMessage));
        messageInput.value = '';
    }
    event.preventDefault();
}


function onMessageReceived(payload) {
    var message = JSON.parse(payload.body);

    var messageElement = document.createElement('li');

    console.log(payload)
    if(message.type === 'JOIN') {
        messageElement.classList.add('event-message');
        message.content = message.sender + ' joined!';
    } else if (message.type === 'LEAVE') {
        messageElement.classList.add('event-message');
        message.content = message.sender + ' left!';
    } else {
        messageElement.classList.add('chat-message');

        var avatarElement = document.createElement('i');
        var avatarText = document.createTextNode(message.sender[0]);
        avatarElement.appendChild(avatarText);
        avatarElement.style['background-color'] = getAvatarColor(message.sender);

        messageElement.appendChild(avatarElement);

        var usernameElement = document.createElement('span');
        var usernameText = document.createTextNode(message.sender);
        usernameElement.appendChild(usernameText);
        messageElement.appendChild(usernameElement);
    }

    var textElement = document.createElement('p');
    var messageText = document.createTextNode(message.content);
    textElement.appendChild(messageText);

    messageElement.appendChild(textElement);

    messageArea.appendChild(messageElement);
    messageArea.scrollTop = messageArea.scrollHeight;
}


function getAvatarColor(messageSender) {
    var hash = 0;
    for (var i = 0; i < messageSender.length; i++) {
        hash = 31 * hash + messageSender.charCodeAt(i);
    }

    var index = Math.abs(hash % colors.length);
    return colors[index];
}

usernameForm.addEventListener('submit', connect, true)
messageForm.addEventListener('submit', sendMessage, true)
static/css/main.css

* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

html,body {
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    padding: 0;
    font-weight: 400;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.58;
    color: #333;
    background-color: #f4f4f4;
    height: 100%;
}

body:before {
    height: 50%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: #128ff2;
    content: "";
    z-index: 0;
}

.clearfix:after {
    display: block;
    content: "";
    clear: both;
}

.hidden {
    display: none;
}

.form-control {
    width: 100%;
    min-height: 38px;
    font-size: 15px;
    border: 1px solid #c8c8c8;
}

.form-group {
    margin-bottom: 15px;
}

input {
    padding-left: 10px;
    outline: none;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 20px;
    margin-bottom: 20px;
}

h1 {
    font-size: 1.7em;
}

a {
    color: #128ff2;
}

button {
    box-shadow: none;
    border: 1px solid transparent;
    font-size: 14px;
    outline: none;
    line-height: 100%;
    white-space: nowrap;
    vertical-align: middle;
    padding: 0.6rem 1rem;
    border-radius: 2px;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    min-height: 38px;
}

button.default {
    background-color: #e8e8e8;
    color: #333;
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.12);
}

button.primary {
    background-color: #128ff2;
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.12);
    color: #fff;
}

button.accent {
    background-color: #ff4743;
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.12);
    color: #fff;
}

#username-page {
    text-align: center;
}

.username-page-container {
    background: #fff;
    box-shadow: 0 1px 11px rgba(0, 0, 0, 0.27);
    border-radius: 2px;
    width: 100%;
    max-width: 500px;
    display: inline-block;
    margin-top: 42px;
    vertical-align: middle;
    position: relative;
    padding: 35px 55px 35px;
    min-height: 250px;
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    margin: 0 auto;
    margin-top: -160px;
}

.username-page-container .username-submit {
    margin-top: 10px;
}


#chat-page {
    position: relative;
    height: 100%;
}

.chat-container {
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    background-color: #fff;
    box-shadow: 0 1px 11px rgba(0, 0, 0, 0.27);
    margin-top: 30px;
    height: calc(100% - 60px);
    max-height: 600px;
    position: relative;
}

#chat-page ul {
    list-style-type: none;
    background-color: #FFF;
    margin: 0;
    overflow: auto;
    overflow-y: scroll;
    padding: 0 20px 0px 20px;
    height: calc(100% - 150px);
}

#chat-page #messageForm {
    padding: 20px;
}

#chat-page ul li {
    line-height: 1.5rem;
    padding: 10px 20px;
    margin: 0;
    border-bottom: 1px solid #f4f4f4;
}

#chat-page ul li p {
    margin: 0;
}

#chat-page .event-message {
    width: 100%;
    text-align: center;
    clear: both;
}

#chat-page .event-message p {
    color: #777;
    font-size: 14px;
    word-wrap: break-word;
}

#chat-page .chat-message {
    padding-left: 68px;
    position: relative;
}

#chat-page .chat-message i {
    position: absolute;
    width: 42px;
    height: 42px;
    overflow: hidden;
    left: 10px;
    display: inline-block;
    vertical-align: middle;
    font-size: 18px;
    line-height: 42px;
    color: #fff;
    text-align: center;
    border-radius: 50%;
    font-style: normal;
    text-transform: uppercase;
}

#chat-page .chat-message span {
    color: #333;
    font-weight: 600;
}

#chat-page .chat-message p {
    color: #43464b;
}

#messageForm .input-group input {
    float: left;
    width: calc(100% - 85px);
}

#messageForm .input-group button {
    float: left;
    width: 80px;
    height: 38px;
    margin-left: 5px;
}

.chat-header {
    text-align: center;
    padding: 15px;
    border-bottom: 1px solid #ececec;
}

.chat-header h2 {
    margin: 0;
    font-weight: 500;
}

.connecting {
    padding-top: 5px;
    text-align: center;
    color: #777;
    position: absolute;
    top: 65px;
    width: 100%;
}


@media screen and (max-width: 730px) {

    .chat-container {
        margin-left: 10px;
        margin-right: 10px;
        margin-top: 10px;
    }
}

@media screen and (max-width: 480px) {
    .chat-container {
        height: calc(100% - 30px);
    }

    .username-page-container {
        width: auto;
        margin-left: 15px;
        margin-right: 15px;
        padding: 25px;
    }

    #chat-page ul {
        height: calc(100% - 120px);
    }

    #messageForm .input-group button {
        width: 65px;
    }

    #messageForm .input-group input {
        width: calc(100% - 70px);
    }

    .chat-header {
        padding: 10px;
    }

    .connecting {
        top: 60px;
    }

    .chat-header h2 {
        font-size: 1.1em;
    }
}



config/WebSocketConfig

package com.example.websocketdemo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.*;

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/ws").withSockJS();
    }


    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        registry.setApplicationDestinationPrefixes("/app");
        registry.enableSimpleBroker("/topic");

    }
}


---------------------------------------------
  
controller/ChatController

package com.example.websocketdemo.controller;

import com.example.websocketdemo.model.ChatMessage;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
import org.springframework.stereotype.Controller;


@Controller
public class ChatController {

    @MessageMapping("/chat.sendMessage")
    @SendTo("/topic/public")
    public ChatMessage sendMessage(@Payload ChatMessage chatMessage) {
        return chatMessage;
    }

    @MessageMapping("/chat.addUser")
    @SendTo("/topic/public")
    public ChatMessage addUser(@Payload ChatMessage chatMessage,
                               SimpMessageHeaderAccessor headerAccessor) {
        // Add username in web socket session
        headerAccessor.getSessionAttributes().put("username", chatMessage.getSender());
        return chatMessage;
    }

}

----------------------------------------------------

controller/WebSocketEventListener

package com.example.websocketdemo.controller;

import com.example.websocketdemo.model.ChatMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.messaging.simp.SimpMessageSendingOperations;
import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.messaging.SessionConnectedEvent;
import org.springframework.web.socket.messaging.SessionDisconnectEvent;

@Component
public class WebSocketEventListener {

    private static final Logger logger = LoggerFactory.getLogger(WebSocketEventListener.class);

    @Autowired
    private SimpMessageSendingOperations messagingTemplate;

    @EventListener
    public void handleWebSocketConnectListener(SessionConnectedEvent event) {
        logger.info("Received a new web socket connection");
    }

    @EventListener
    public void handleWebSocketDisconnectListener(SessionDisconnectEvent event) {
        StompHeaderAccessor headerAccessor = StompHeaderAccessor.wrap(event.getMessage());

        String username = (String) headerAccessor.getSessionAttributes().get("username");
        if(username != null) {
            logger.info("User Disconnected : " + username);

            ChatMessage chatMessage = new ChatMessage();
            chatMessage.setType(ChatMessage.MessageType.LEAVE);
            chatMessage.setSender(username);

            messagingTemplate.convertAndSend("/topic/public", chatMessage);
        }
    }
}

------------------------------------------

model/ChatMessage
package com.example.websocketdemo.model;

import lombok.Data;

@Data
public class ChatMessage {
    private MessageType type;
    private String content;
    private String sender;

    public enum MessageType {
        CHAT,
        JOIN,
        LEAVE
    }
}

-----------------------------------
WebsocketDemoApplication

package com.example.websocketdemo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class WebsocketDemoApplication {

	public static void main(String[] args) {
		SpringApplication.run(WebsocketDemoApplication.class, args);
	}
}
/*gift_slide_front_all MAIN SLIDE MEDIA*/
function gift_slide_front_all($atts) {

        // Define default attributes
        $attributes = shortcode_atts(
            array(
                'gift_slide' => 'one',
            ), 
            $atts
        );
    
        $gift_slide = $attributes['gift_slide'];
        
        if ($gift_slide == 'one') { $gift_slide_number = 'slide1_type'; }
        if ($gift_slide == 'two') { $gift_slide_number = 'slide2_type'; }
        if ($gift_slide == 'three') { $gift_slide_number = 'slide3_type'; }
        if ($gift_slide == 'four') { $gift_slide_number = 'slide4_type'; }
    $slidetype = get_field($gift_slide_number, get_the_ID());
    if ( $slidetype == 'photo editor') {
        if ($gift_slide == 'one') { $gift_field = 'gift_image'; }
        if ($gift_slide == 'two') { $gift_field = 'gift_image_2'; }
        if ($gift_slide == 'three') { $gift_field = 'gift_image_3'; }
        if ($gift_slide == 'four') { $gift_field = 'gift_image_4'; }
    	$img_id = get_field($gift_field, get_the_ID());
		if (!empty($img_id)) {
			$media_url = wp_get_attachment_image_url($img_id, 'full');      
			if (!empty($media_url)) {
              return $media_url;
		}
	}
} else {
        if ($gift_slide == 'one') { $gift_field = 'gif1'; }
        if ($gift_slide == 'two') { $gift_field = 'gif2'; }
        if ($gift_slide == 'three') { $gift_field = 'gif3'; }
        if ($gift_slide == 'four') { $gift_field = 'gif4'; }
    	$media_id = get_field($gift_field, get_the_ID());
        if (!empty($media_id) && is_numeric($media_id)){
    $media_url = wp_get_attachment_url($media_id);
    if (function_exists('get_url_without_url_params')) {
        $media_url = get_url_without_url_params( $media_url );
    }
    $filetype = wp_check_filetype($media_url);
        if ($filetype['ext'] == 'mp4') {                    
           return '<video id="media'. $gift_field .'" autoplay muted>
            <source src="' . $media_url . '" type="audio/mpeg">
            Your browser does not support the audio tag.
            </video>';
        }else{
           return '<img id="media'. $gift_field .'" src="' . $media_url . '">';
        }
}
if (!empty($media_id) && !is_numeric($media_id)){
    $media_url = $media_id; 
    $filetype = wp_check_filetype($media_id);
       if ($filetype['ext'] == 'mp4') {
        return '<video id="media'. $gift_field .'" autoplay muted>
            <source src="' . $media_url . '" type="audio/mpeg">
            Your browser does not support the audio tag.
            </video>';
        }else{
           return '<img id="media'. $gift_field .'" src="' . $media_url . '">';                    
        }
}
}
}
// register shortcode
add_shortcode('gift_slide_front_all', 'gift_slide_front_all');




/*gift_slide1_bk_all BACKGROUND SLIDE MEDIA*/
function gift_slide_bkg_all($gift_slide) {
    $ua = strtolower($_SERVER["HTTP_USER_AGENT"]);
    $isMob = is_numeric(strpos($ua, "mobile"));
    if ($isMob != 'mobile') {
        if ($gift_slide == 'one') { $gift_slide_number = 'slide1_type'; }
        if ($gift_slide == 'two') { $gift_slide_number = 'slide2_type'; }
        if ($gift_slide == 'three') { $gift_slide_number = 'slide3_type'; }
        if ($gift_slide == 'four') { $gift_slide_number = 'slide4_type'; }
        $slidetype = get_field($gift_slide_number, get_the_ID());
        if ($slidetype == 'photo editor') {
            if ($gift_slide == 'one') { $gift_field = 'gift_image'; }
            if ($gift_slide == 'two') { $gift_field = 'gift_image_2'; }
            if ($gift_slide == 'three') { $gift_field = 'gift_image_3'; }
            if ($gift_slide == 'four') { $gift_field = 'gift_image_4'; }
            $img_id = get_field($gift_field, get_the_ID());
            if (!empty($img_id)) {
                $media_url = wp_get_attachment_image_url($img_id, 'full');
                if (!empty($media_url)) {
                    return $media_url;
                }
            }
        } else {
            if ($gift_slide == 'one') { $gift_field = 'gif1'; }
            if ($gift_slide == 'two') { $gift_field = 'gif2'; }
            if ($gift_slide == 'three') { $gift_field = 'gif3'; }
            if ($gift_slide == 'four') { $gift_field = 'gif4'; }
            $media_id = get_field($gift_field, get_the_ID());

            if (!empty($media_id) && is_numeric($media_id)) {
                // Try fetching from the _cloudinary meta field
                $cloudinary_data = get_post_meta($media_id, '_cloudinary', true);
                if (isset($cloudinary_data['_cloudinary_url'])) {
                    $media_url = $cloudinary_data['_cloudinary_url'];
                } else {
                    $media_url = wp_get_attachment_url($media_id);
                }
                $filetype = wp_check_filetype($media_url);
                if ($filetype['ext'] == 'mp4') {
                    if (strpos($media_url, "cloudinary.com") !== false) {
                        $parts = explode('/upload/', $media_url);
                        $transformed_media_url = $parts[0]. '/upload/f_auto,q_auto,so_2/'.$parts[1];
                        $transformed_media_url = str_replace(".mp4", ".jpg", $transformed_media_url);
                        return $transformed_media_url;
                    }
                } else {
                    return $media_url;
                }
            }
        }
        if (!empty($media_id) && !is_numeric($media_id)) {
            $media_url = $media_id;
            $filetype = wp_check_filetype($media_id);
            if ($filetype['ext'] == 'mp4') {
                $media_name = basename(get_attached_file($media_id));
                $media_name_jpg = str_replace(".mp4", ".jpg", "$media_name");
                return "https://res.cloudinary.com/drt2tlz1j/video/upload/fn/$media_name_jpg";
            } else {
                return $media_url;
            }
        }
    }
}
// register shortcode
add_shortcode('gift_slide_bkg_all', 'gift_slide_bkg_all');
#include <LiquidCrystal.h>

const int butpin = 8;
int buttonState = HIGH;
int lastbuttonState = HIGH;
unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 50;
int butVal;
int pressCounter;
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup(){

  pinMode(8, INPUT);

  lcd.begin(16, 2);
  Serial.begin(9600);

}

void loop(){

  butVal = digitalRead(butpin);

  if(butVal != lastbuttonState){

    lastDebounceTime = millis();

  }

  if((millis() - lastDebounceTime) > debounceDelay){

    if(butVal != buttonState){
      buttonState = butVal;

      if(buttonState == LOW){
       pressCounter++;
       lcd.setCursor(0, 0);        
       lcd.print("Steps: ");
       lcd.print(pressCounter);
     }
    }

    
  }
  
  lastbuttonState = butVal;


}
sudo apt update 2>&1 1>/dev/null | sed -ne 's/.*NO_PUBKEY //p' | while read key; do if ! [[ ${keys[*]} =~ "$key" ]]; then sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys "$key"; keys+=("$key"); fi; done
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers

Very simple HTTP server in python for logging requests
Usage::
    ./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging

class S(BaseHTTPRequestHandler):
    def _set_response(self):
        self.send_response(200)
        self.send_header('Content-type', 'text/html')
        self.end_headers()

    def do_GET(self):
        logging.info("GET request,\nPath: %s\nHeaders:\n%s\n", str(self.path), str(self.headers))
        self._set_response()
        self.wfile.write("GET request for {}".format(self.path).encode('utf-8'))

    def do_POST(self):
        content_length = int(self.headers['Content-Length']) # <--- Gets the size of data
        post_data = self.rfile.read(content_length) # <--- Gets the data itself
        logging.info("POST request,\nPath: %s\nHeaders:\n%s\n\nBody:\n%s\n",
                str(self.path), str(self.headers), post_data.decode('utf-8'))

        self._set_response()
        self.wfile.write("POST request for {}".format(self.path).encode('utf-8'))

def run(server_class=HTTPServer, handler_class=S, port=8080):
    logging.basicConfig(level=logging.INFO)
    server_address = ('', port)
    httpd = server_class(server_address, handler_class)
    logging.info('Starting httpd...\n')
    try:
        httpd.serve_forever()
    except KeyboardInterrupt:
        pass
    httpd.server_close()
    logging.info('Stopping httpd...\n')

if __name__ == '__main__':
    from sys import argv

    if len(argv) == 2:
        run(port=int(argv[1]))
    else:
        run()
pm2 status
pm2 logs player-server
pm2 stop player-server

sudo reboot
sudo shutdown

ctrl shif p(run player server), k(kill the player server), r(reboot the pi)
ctrl alt t
// possible errors
'no-cond-assign': ['error', 'always'],
'no-console': 'warn',
'no-constant-condition': 'warn',
'no-debugger': 'warn',

// best practices
'array-callback-return': 'error',
'block-scoped-var': 'error',
'curly': ['error', 'multi-or-nest', 'consistent'],
'eqeqeq': ['error', 'smart'],
'no-alert': 'warn',
'no-case-declarations': 'error',
'no-multi-spaces': 'error',
'no-multi-str': 'error',
'no-return-assign': 'error',
'no-return-await': 'error',
'no-void': 'error',
'no-with': 'error',
'require-await': 'error',

// variables
'no-unused-vars': 'warn',

// stylistic issues
'array-bracket-newline': ['error', 'consistent'],
'array-bracket-spacing': ['error', 'never'],
'array-element-newline': ['error', 'consistent'],
'block-spacing': ['error', 'always'],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'camelcase': 'off',
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': ['error', { before: false, after: true }],
'comma-style': ['error', 'last'],
'func-call-spacing': ['error', 'never'],
'indent': [
  'error',
  2,
  { SwitchCase: 1, VariableDeclarator: 'first', outerIIFEBody: 1 },
],
'max-len': ['error', { tabWidth: 2 }],
'no-lonely-if': 'error',
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement'],
'object-curly-newline': ['error', { consistent: true, multiline: true }],
'object-curly-spacing': ['error', 'always'],
'object-property-newline': [
  'error',
  { allowAllPropertiesOnSameLine: true },
],
'operator-linebreak': ['error', 'before'],
'quote-props': ['error', 'consistent-as-needed'],
'quotes': ['error', 'single'],
'semi': ['error', 'never'],
'space-before-function-paren': ['error', 'always'],
'spaced-comment': [
  'error',
  'always',
  { markers: ['?', '!', '//', '*', '/'] },
],

// ecmascript 6
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: false }],
'generator-star-spacing': ['error', { before: false, after: true }],
'no-var': 'error',
'object-shorthand': [
  'error',
  'always',
  { ignoreConstructors: false, avoidQuotes: true },
],
'prefer-arrow-callback': [
  'error',
  { allowNamedFunctions: false, allowUnboundThis: true },
],
'prefer-const': [
  'error',
  { destructuring: 'any', ignoreReadBeforeAssign: true },
],
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'template-curly-spacing': ['error', 'never'],

// import
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-absolute-path': 'off',
'import/no-mutable-exports': 'error',
'import/no-unresolved': 'off',
'import/order': [
  'error',
  {
    'groups': [
      ['builtin', 'external'],
      'internal',
      'type',
      ['parent', 'sibling', 'index'],
    ],
    'alphabetize': { order: 'asc', caseInsensitive: true },
    'newlines-between': 'always',
  },
],

// yml
'yml/sort-keys': 'error',

// jsonc
'jsonc/array-bracket-newline': ['error', 'consistent'],
'jsonc/array-bracket-spacing': ['error', 'never'],
'jsonc/comma-style': ['error', 'last'],
'jsonc/indent': ['error', 2],
'jsonc/key-spacing': [
  'error',
  { beforeColon: false, afterColon: true, mode: 'strict' },
],
'jsonc/object-curly-newline': ['error', { consistent: true }],
'jsonc/object-curly-spacing': ['error', 'always'],
'jsonc/sort-keys': 'error',

// unicorn
'unicorn/better-regex': 'error',
'unicorn/consistent-destructuring': 'error',
'unicorn/consistent-function-scoping': 'warn',
'unicorn/empty-brace-spaces': 'error',
'unicorn/error-message': 'warn',
'unicorn/no-abusive-eslint-disable': 'error',
'unicorn/no-instanceof-array': 'error',
'unicorn/no-lonely-if': 'error',
'unicorn/no-new-array': 'error',
'unicorn/no-new-buffer': 'error',
'unicorn/no-unreadable-array-destructuring': 'error',
'unicorn/no-unsafe-regex': 'warn',
'unicorn/no-useless-length-check': 'error',
'unicorn/no-useless-spread': 'error',
'unicorn/no-zero-fractions': 'error',
'unicorn/number-literal-case': 'error',
'unicorn/prefer-array-find': 'error',
'unicorn/prefer-array-index-of': 'error',
'unicorn/prefer-array-some': 'error',
'unicorn/prefer-date-now': 'error',
'unicorn/prefer-default-parameters': 'error',
'unicorn/prefer-includes': 'error',
'unicorn/prefer-negative-index': 'error',
'unicorn/prefer-prototype-methods': 'error',
'unicorn/prefer-string-starts-ends-with': 'error',
'unicorn/prefer-type-error': 'error',
  // Check the validity of uploaded files
  const checkFileValidity = useCallback(async (files: any[], documentTypeID: number) => {
    const maxFileSize = 20 * 1024 * 1024;
    const passportSizePhotoValidDocTypes = ['jpeg', 'png', 'jpg', 'bmp'];

    const docPresent = draftsmanUploadedDocumentList.filter((doc:any) => {
      if (doc.documentTypeID === 4) return doc;
    });

    console.log('docPresent', docPresent);

    let isMaxSize = true;

    // Filter valid files based on extension and file size
    const validFiles = files.filter((file: { name: string; size: number; }) => {
      console.log('validFile', file);
      const validExt = file.name.split('.').pop();
      if (file.size <= maxFileSize) isMaxSize = false;
      const checkValidityCondition = passportSizePhotoValidDocTypes.includes(validExt);
      if (documentTypeID === 4) {
        if (checkValidityCondition) return file;
        setShowInvalidFilesModal(true);
      } else {
        return file;
      }
    });

    console.log('validFiles', validFiles);
    if (documentTypeID === 4) {
      if (docPresent.length === 0) {
        saveValidFiles(validFiles, documentTypeID);
      } else {
        await dispatch(resetErrorState());
        await dispatch(setErrorInfo('You can only add one passport size photo'));
      }
    } else if (documentTypeID !== 4) {
      saveValidFiles(validFiles, documentTypeID);
    }

    // Filter invalid files
    const invalidFiles = files.filter((file: any) => !validFiles.includes(file));

    if (invalidFiles.length > 0) {
      setShowInvalidFilesModal(true);
    } else if (validFiles.length > 0) {
      saveValidFiles(validFiles, documentTypeID);

      //   // Update the documentTypeArray state with the new file name
      const updatedDocumentTypeArray = documentTypeArray?.map((docType) => {
        if (docType.documentTypeID === documentTypeID) {
          return { ...docType, documentName: validFiles[0]?.name };
        }
        return docType;
      });

      setDocumentTypeArray(updatedDocumentTypeArray);
      console.log('Updated Document Array:', updatedDocumentTypeArray);
    }
  }, [saveValidFiles, documentTypeArray, setShowInvalidFilesModal, setDocumentTypeArray]);
 const isValidExtension = validExtensions.some((ext) => file.name.toLowerCase().endsWith(ext));
      const isWithinMaxSize = file.size <= maxFileSize;
      return isValidExtension && isWithinMaxSize;
setDraftsmanUploadedDocumentList: (state, { payload }) => {
      state.loading = false;
      if (state.draftsmanGUID !== '') {
        if (payload[0]?.documentTypeID === 409) {
          payload.forEach((item: any) => {
            state.draftsmanUploadedDocumentList.push(item);
          });
        } else {
          state.draftsmanUploadedDocumentList = state.draftsmanUploadedDocumentList.filter((item: any) => item.documentTypeID !== payload[0]?.documentTypeID);
          state.draftsmanUploadedDocumentList.push(payload[0]);
        }
      } else {
        payload.forEach((item: any) => {
          // Replace passport size photo
          if (item?.documentTypeID !== 4) {
            state.draftsmanUploadedDocumentList.push(item);
          }
        });
        if (payload[0]?.documentTypeID === 4) {
          state.draftsmanUploadedDocumentList = state.draftsmanUploadedDocumentList.filter((doc: any) => doc.documentTypeID !== payload?.documentTypeID);
          const fileExtension = payload[0].name.split('.').pop();
          const passportSizePhotoValidDocTypes = ['jpeg', 'png', 'jpg', 'bmp'];
          const isValid = passportSizePhotoValidDocTypes.includes(fileExtension);
          if (isValid) state.draftsmanUploadedDocumentList.push(payload[0]);
        }
      }
      state.isDocumentsChanged = !state.isDocumentsChanged;
    },
const canvas = document.querySelector("canvas");

const ctx = canvas.getContext("2d");

const width = (canvas.width = window.innerWidth);
const height = (canvas.height = window.innerHeight)
*{
  margin: 0;
  background-color: rgb(255, 255, 255);
}
.box{
  text-align: center;
  align-items: center;
  justify-items: center;
  margin-top: 17%;
  margin-left: 35%;
  justify-content: center;
  display: flex;
  border-radius: 20px;
  border: 1px solid rgb(4, 91, 241);
  width: 25%;
  height:350px;
}
label{
  font-size: 18px;
  color: rgb(120, 164, 240);
}
input{
  border: 1px solid rgb(4, 91, 241);
  border-radius: 10px;
  height: 2.5rem;
  padding: 0 10px;
  font-size: 17px;
  color: rgb(255, 255, 255);
  margin-left: 10px;
  margin-bottom: 1rem;
  background-color: transparent;
  cursor: pointer;
}

button{
  width: 5rem;
  height: 2rem;
  margin-right: 8rem;
  margin-top: 10px;
  border: 2px solid transparent;
  color: white;
  border-radius: 19px;
  padding-top: 3px;
  padding-bottom: 3px;
  background-color: rgb(4, 91, 241);
  font-size: 18px;
  cursor: pointer;
}
  <div class="box">
    <form>
      <label class="user-label" for="username"><i class="fa-solid fa-user"></i></label>
      <input id="username" name="username" type="text" maxlength="25" required autocomplete="off">
      <br>
      <label for="pasword"><i class="fa-solid fa-lock"></i></label>
      <input id="password" name="password" type="password" maxlength="25" required>
      <br>
      <button type="submit">Login</button>
    </form>
  </div>
public class Student {
	
	private String name;
	private int age;
	private int id;
	private double gpa;
	int foo;
	
	Student(String name, int age, int id) {
		this.name = name;
		this.age = age;
		this.id = id;
		gpa = 0.0;
		foo = 0;
	}
//Get
	public String getName() {
		return name;
	}
	
	public int getAge() {
		return age;
	}
	public int getId() {
		return id;
	}
	public double getGpa() {
		return gpa;
	}
//Set
	public void setName(String name) {
		this.name = name;
	}
	public void setAge (int age) {
		this.age = age;
	}
	public void setId(int id) {
		this.id = id;
	}
	public void setGpa(double gpa) {
		this.gpa = gpa;
	}
	
	public String toString() {
		return "Name: " + name + " Age: " + age + " Id: " + id + " Gpa: " + gpa;
	}

}

public static void main(String[] args) {
		
		Student s1 = new Student("Mohamed", 24, 210209327);
		
		s1.setGpa(98.67);
		
		System.out.println("Student Name: " + s1.getName());
		System.out.println("Student Age: " + s1.getAge());
		System.out.println("Student Id: " + s1.getId());
		System.out.println("Student Gpa: " + s1.getGpa());
		
		System.out.println(s1.toString());
		
		s1.foo = 5;
		System.out.println("Student foo: " + s1.foo);

	}

}
//OUTPUT:
Student Name: Mohamed
Student Age: 24
Student Id: 210209327
Student Gpa: 98.67
Name: Mohamed Age: 24 Id: 210209327 Gpa: 98.67
Student foo: 5
star

Tue Nov 14 2023 19:52:17 GMT+0000 (Coordinated Universal Time)

@dr_dziedzorm

star

Tue Nov 14 2023 19:51:41 GMT+0000 (Coordinated Universal Time)

@dr_dziedzorm

star

Tue Nov 14 2023 18:07:30 GMT+0000 (Coordinated Universal Time)

@diptish

star

Tue Nov 14 2023 16:44:04 GMT+0000 (Coordinated Universal Time) https://app.cacher.io/load

@knguyencookie

star

Tue Nov 14 2023 16:19:48 GMT+0000 (Coordinated Universal Time)

@Shesek

star

Tue Nov 14 2023 15:35:00 GMT+0000 (Coordinated Universal Time) https://web.simple-mmo.com/inventory/storage

@alcool

star

Tue Nov 14 2023 15:19:18 GMT+0000 (Coordinated Universal Time)

@KutasKozla #java

star

Tue Nov 14 2023 15:01:08 GMT+0000 (Coordinated Universal Time)

@KutasKozla #java

star

Tue Nov 14 2023 14:47:37 GMT+0000 (Coordinated Universal Time)

@bevo

star

Tue Nov 14 2023 13:40:00 GMT+0000 (Coordinated Universal Time)

@KutasKozla #java

star

Tue Nov 14 2023 13:23:07 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/c/exercise.php?filename

@usman_hamed

star

Tue Nov 14 2023 13:21:47 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/c/exercise.php?filename

@usman_hamed

star

Tue Nov 14 2023 13:21:44 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/c/exercise.php?filename

@usman_hamed

star

Tue Nov 14 2023 13:21:42 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/c/exercise.php?filename

@usman_hamed

star

Tue Nov 14 2023 13:15:49 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/c/index.php

@usman_hamed

star

Tue Nov 14 2023 12:34:58 GMT+0000 (Coordinated Universal Time)

@batalkin #javascript

star

Tue Nov 14 2023 12:26:53 GMT+0000 (Coordinated Universal Time)

@batalkin #javascript

star

Tue Nov 14 2023 12:13:59 GMT+0000 (Coordinated Universal Time) https://ideogram.ai/g/aaHP3uaxR5G8f_Pa-xtSUw/0

@Umar

star

Tue Nov 14 2023 11:30:31 GMT+0000 (Coordinated Universal Time) https://github.com/andrelmlins/vue-scroll-shadow/blob/c39bc27935dfbe611fab7894760a959152a14dbd/src/ScrollShadow.vue

@batalkin #javascript

star

Tue Nov 14 2023 11:06:06 GMT+0000 (Coordinated Universal Time) https://gabrieleromanato.com/2022/08/python-estrarre-gli-url-da-una-sitemap

@dona__x

star

Tue Nov 14 2023 11:05:45 GMT+0000 (Coordinated Universal Time) https://gabrieleromanato.com/2022/08/python-estrarre-gli-url-da-una-sitemap

@dona__x

star

Tue Nov 14 2023 11:05:16 GMT+0000 (Coordinated Universal Time) https://gabrieleromanato.com/2022/08/python-estrarre-gli-url-da-una-sitemap

@dona__x

star

Tue Nov 14 2023 10:42:46 GMT+0000 (Coordinated Universal Time)

@KutasKozla #java

star

Tue Nov 14 2023 09:52:54 GMT+0000 (Coordinated Universal Time)

@naunie

star

Tue Nov 14 2023 08:53:26 GMT+0000 (Coordinated Universal Time)

@yolobotoffender

star

Tue Nov 14 2023 08:24:50 GMT+0000 (Coordinated Universal Time) https://dronein.com/wp-admin/theme-editor.php?file

@Pulak

star

Tue Nov 14 2023 08:15:33 GMT+0000 (Coordinated Universal Time)

@yolobotoffender

star

Tue Nov 14 2023 04:47:45 GMT+0000 (Coordinated Universal Time)

@naunie

star

Tue Nov 14 2023 02:41:53 GMT+0000 (Coordinated Universal Time)

@daniel1000

star

Tue Nov 14 2023 02:40:52 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

@daniel1000

star

Tue Nov 14 2023 01:38:44 GMT+0000 (Coordinated Universal Time)

@manhmd #java

star

Tue Nov 14 2023 01:37:59 GMT+0000 (Coordinated Universal Time)

@manhmd #java

star

Tue Nov 14 2023 01:37:16 GMT+0000 (Coordinated Universal Time)

@manhmd #java

star

Tue Nov 14 2023 01:33:11 GMT+0000 (Coordinated Universal Time)

@manhmd #java

star

Mon Nov 13 2023 23:18:05 GMT+0000 (Coordinated Universal Time)

@FOrestNAtion

star

Mon Nov 13 2023 22:42:30 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/extension/initializing?newuser

@jamile46

star

Mon Nov 13 2023 16:56:53 GMT+0000 (Coordinated Universal Time)

@daniel1000

star

Mon Nov 13 2023 16:49:58 GMT+0000 (Coordinated Universal Time) https://www.linuxuprising.com/2019/06/fix-missing-gpg-key-apt-repository.html

@anubisDev

star

Mon Nov 13 2023 16:26:17 GMT+0000 (Coordinated Universal Time) https://gist.github.com/mdonkers/63e115cc0c79b4f6b8b3a6b797e485c7

@quaie #python

star

Mon Nov 13 2023 14:21:59 GMT+0000 (Coordinated Universal Time)

@Jeremicah

star

Mon Nov 13 2023 14:10:15 GMT+0000 (Coordinated Universal Time) https://www.npmjs.com/package/@prazdevs/eslint-config-javascript

@cdy94

star

Mon Nov 13 2023 12:45:27 GMT+0000 (Coordinated Universal Time)

@alfred555 #react.js

star

Mon Nov 13 2023 11:51:13 GMT+0000 (Coordinated Universal Time)

@alfred555 #react.js

star

Mon Nov 13 2023 10:40:23 GMT+0000 (Coordinated Universal Time) https://www.bauut.com/admin_clouding/index.php?controller

@applyco #undefined

star

Mon Nov 13 2023 09:36:14 GMT+0000 (Coordinated Universal Time)

@alfred555 #react.js

star

Mon Nov 13 2023 09:20:09 GMT+0000 (Coordinated Universal Time) undefined

@niteshpuri

star

Mon Nov 13 2023 09:19:26 GMT+0000 (Coordinated Universal Time) https://developer.mozilla.org/zh-CN/docs/Learn/JavaScript/Objects/Object_building_practice

@yangsir

star

Mon Nov 13 2023 05:33:19 GMT+0000 (Coordinated Universal Time)

@Disdark10

star

Mon Nov 13 2023 05:22:50 GMT+0000 (Coordinated Universal Time)

@Disdark10

star

Sun Nov 12 2023 21:53:28 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #java

Save snippets that work with our extensions

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