Skip to content

Instantly share code, notes, and snippets.

@5minslearn
5minslearn / sliding_window_max_sum_of_sub_array_of_size_k.ts
Last active January 9, 2024 18:12
Find maximum sum of sub-array of size k using sliding window technique
function findMaxSumOfSequence(listOfItems: number[], sequenceLength: number) {
if (listOfItems.length < sequenceLength) {
return null;
}
let start = 0,
end = 0,
maxSum = 0,
windowSum = 0;
while (end < sequenceLength) {
windowSum += listOfItems[end];
@5minslearn
5minslearn / sum_of_max_sub_array_of_size_k.ts
Created January 9, 2024 17:33
Find maximum sum of a sub-array of size k - Native method
function findMaxSumOfSequence(listOfItems: number[], sequenceLength: number) {
if (listOfItems.length < sequenceLength) {
return null;
}
let maxSum = -Infinity;
for (let i = 0; i <= listOfItems.length - sequenceLength; i++) {
let sum = 0;
for (let j = i; j < i + sequenceLength; j++) {
sum += listOfItems[j];
import styles from "@/styles/Home.module.css";
import { Bucket } from "sst/node/bucket";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
export async function getServerSideProps() {
const command = new PutObjectCommand({
ACL: "public-read",
Key: crypto.randomUUID(),
Bucket: Bucket.public.bucketName,
[paths]
train = null
dev = null
vectors = "en_core_web_lg"
init_tok2vec = null
[system]
gpu_allocator = null
seed = 0
# This is an auto-generated partial config. To use it with 'spacy train'
# you can run spacy init fill-config to auto-fill all default settings:
# python -m spacy init fill-config ./base_config.cfg ./config.cfg
[paths]
train = null
dev = null
vectors = "en_core_web_lg"
[system]
gpu_allocator = null
@5minslearn
5minslearn / event_schedule_data.json
Created July 9, 2023 17:03
Event Schedule Sample Data
{
"examples": [
{
"id": "ca-1",
"content": "Schedule a calendar event in Teak oaks HOA about competitions happening tomorrow",
"annotations": [
{
"start": 0,
"end": 7,
"tag_name": "action"
import amqp from "amqplib";
const queue = "product_inventory";
(async () => {
try {
const connection = await amqp.connect("amqp://localhost");
const channel = await connection.createChannel();
process.once("SIGINT", async () => {
import amqp from "amqplib";
const queue = "product_inventory";
const text = {
item_id: "macbook",
text: "This is a sample message to send receiver to check the ordered Item Availablility",
};
(async () => {
let connection;
@5minslearn
5minslearn / git_installation_and_configuration_script.txt
Last active November 12, 2022 13:17
Git installation and Configuration Script
# Install Git
sudo apt-get update
sudo apt-get -y install git
# Configure Git with your name and email
git config --global user.name "your_name"
git config --global user.email "your_email"
mkdir Temp_PDF_Files # Create new directory
cp ./*.pdf Temp_PDF_Files/ # Copy pdf files to Temp_PDF_Files directory