Skip to content

Instantly share code, notes, and snippets.

View deshraj's full-sized avatar

Deshraj Yadav deshraj

View GitHub Profile
@deshraj
deshraj / strands-short-term-memory.py
Created June 19, 2025 08:04
AWS Strands Short-Term Memory Example
#!/usr/bin/env python3
"""
# 🧠 Memory Agent with Session-Based Short-Term Memory
A demonstration of using Strands Agents' memory capabilities to store and retrieve information with session-based short-term memory.
## What This Example Shows
This example demonstrates:
- Creating an agent with memory capabilities
@deshraj
deshraj / mem0_agent.py
Created June 1, 2025 01:33
Mem0 Strands Agent
import logging
from dotenv import load_dotenv
from strands import Agent
from strands_tools import mem0_memory, use_llm
logger = logging.getLogger(__name__)
# Load environment variables from .env file if it exists
load_dotenv()
@deshraj
deshraj / unacademy-ai-data.csv
Last active December 21, 2023 08:55
Unacademy UPSC AI Data (Checkout demo: https://embedchain.ai/a/unacademy-upsc)
We can't make this file beautiful and searchable because it's too large.
https://www.youtube.com/watch?v=2CAm5Hjl8S4
https://www.youtube.com/watch?v=Pe9OEeChbNA
https://www.youtube.com/watch?v=eKh72zCz1YA
https://www.youtube.com/watch?v=HoRW2oUJBDA
https://www.youtube.com/watch?v=z2wdAk3vbS0
https://www.youtube.com/watch?v=IFU7ciWRB4w
https://www.youtube.com/watch?v=8VfLJ9DBHAA
https://www.youtube.com/watch?v=rDZfeYuZatY
https://www.youtube.com/watch?v=O0kpIEZ1Mdw
https://www.youtube.com/watch?v=SZx-uNEYu3M
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
https://isha.sadhguru.org/in/en/wisdom/article/divorce-remarriage
https://isha.sadhguru.org/in/en/wisdom/article/parenting-for-teenager
https://isha.sadhguru.org/in/en/wisdom/article/find-fulfillment-in-life
https://isha.sadhguru.org/in/en/wisdom/article/women-pursue-career
https://isha.sadhguru.org/in/en/wisdom/article/child-no-need-instruction-manual
https://isha.sadhguru.org/in/en/wisdom/article/sadhuru-most-popular-blogs-2018
https://isha.sadhguru.org/in/en/wisdom/article/children-connect-nature
https://isha.sadhguru.org/in/en/wisdom/article/family-matters
https://isha.sadhguru.org/in/en/wisdom/article/how-should-parents-influence-lives
https://isha.sadhguru.org/in/en/wisdom/article/why-youth-turning-to-alcohol-drugs
@deshraj
deshraj / collate.py
Created June 4, 2020 00:54 — forked from rkaplan/collate.py
PyTorch example of a custom collate function that uses shared memory when appropriate
import functools
def my_collate(batch, use_shared_memory=False):
r"""Puts each data field into a tensor with outer dimension batch size"""
error_msg = "batch must contain tensors, numbers, dicts or lists; found {}"
elem_type = type(batch[0])
if isinstance(batch[0], torch.Tensor):
out = None
if use_shared_memory:
@deshraj
deshraj / submission.py
Created November 28, 2018 04:25
fastMRI Submission Script
from common.submit import save_reconstructions
# Run your model on the test data
reconstructions = run_model(my_model, test_data_loader)
# Save the reconstructions to disk under the recons_dir directory
save_reconstructions(reconstructions, recons_dir)
@deshraj
deshraj / train.py
Last active November 28, 2018 04:24
fastMRI Train Snippet
from common import transforms, mri_data as data
# Define the data transform class
class DataTransform:
def __call__(self, kspace, seed, target):
# Preprocess the data here
masked_kspace = transforms.apply_mask(kspace)
image = transforms.ifft2(masked_kspace)
cropped_image = transforms.center_crop(transforms.complex_abs(image))
return cropped_image, target
@deshraj
deshraj / models.py
Last active November 5, 2016 04:03
EvalAI Models
from django.contrib.auth.models import User
from django.contrib.postgres.fields import JSONField
from django.db import models
class TimeStampedModel(models.Model):
created_on = models.DateTimeField(auto_now_add=True)
class Meta:
abstract = True
@deshraj
deshraj / live-mjpeg-stream.py
Created September 13, 2016 21:40 — forked from misaelnieto/live-mjpeg-stream.py
Streaming MJPEG over HTTP with gstreamr and python - WSGI version
#!/usr/bin/python
#based on the ideas from http://synack.me/blog/implementing-http-live-streaming
# Run this script and then launch the following pipeline:
# gst-launch videotestsrc pattern=ball ! video/x-raw-rgb, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! tcpclientsink port=9999
from Queue import Queue
from threading import Thread
from socket import socket
from select import select
from wsgiref.simple_server import WSGIServer, make_server, WSGIRequestHandler

NPTEL Setup on Server

Prerequisites for installing NPTEL on a server:

  1. Ubuntu 14.10 OS Environment
  2. Apache or any other web server installed on that system

Steps for setting up on the server:

  1. First we need to make sure that we are working with the root user otherwise there are a lot of permission issues that arises when we start working.