Skip to content

Instantly share code, notes, and snippets.

View nraychaudhuri's full-sized avatar
💭
Building Tublian

Nilanjan Raychaudhuri nraychaudhuri

💭
Building Tublian
View GitHub Profile
@nraychaudhuri
nraychaudhuri / cursor-agent-system-prompt.txt
Created June 13, 2025 19:52 — forked from sshh12/cursor-agent-system-prompt.txt
Cursor Agent System Prompt (March 2025)
You are a powerful agentic AI coding assistant, powered by Claude 3.5 Sonnet. You operate exclusively in Cursor, the world's best IDE.
You are pair programming with a USER to solve their coding task.
The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.
Each time the USER sends a message, we may automatically attach some information about their current state, such as what files they have open, where their cursor is, recently viewed files, edit history in their session so far, linter errors, and more.
This information may or may not be relevant to the coding task, it is up for you to decide.
Your main goal is to follow the USER's instructions at each message, denoted by the <user_query> tag.
<communication>
1. Be conversational but professional.
sealed trait UrinalStatus { def value: String }
final case object Available extends UrinalStatus {
val value = "Avialable"
}
final case object Occupied extends UrinalStatus {
val value = "Occupied"
}

Keybase proof

I hereby claim:

  • I am nraychaudhuri on github.
  • I am nilanjan (https://keybase.io/nilanjan) on keybase.
  • I have a public key whose fingerprint is E5FB 9991 27E0 074C D2B7 7EF0 8CC4 C3BC B9D5 87B6

To claim this, I am signing this object:

private void busy(FiniteDuration duration) {
pi(duration.toMillis() * 800);
}
private BigDecimal pi(long m) {
int n = 0;
BigDecimal acc = new BigDecimal(0.0);
while(n < m) {
acc = acc.add(gregoryLeibnitz(n));
n += 1;
@nraychaudhuri
nraychaudhuri / CoffeeHouseTest
Created April 2, 2015 07:24
Testing Akka actors using JavaTestKit
import akka.actor.ActorIdentity;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.event.Logging;
import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import com.typesafe.training.coffeehouse.CoffeeHouse;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@nraychaudhuri
nraychaudhuri / TypedAkkaActorRef.scala
Last active August 29, 2015 14:05
Typed Akka actor ref
//PLEASE NOTE: Typing actor refs are really hard problem(take a look at the discussions in Akka mailing list regarding this subject). This is no way a complete solution. This will only work if you know all the possible
//messages an actor can handle (that means no become/unbecome business).
package experiment
import akka.actor.{Props, ActorSystem, Actor, ActorRef}
case class TypedActorRef[A](actorRef: ActorRef) extends AnyVal {
def ![B](msg: B)(implicit ev: A <:< B, sender: ActorRef = Actor.noSender) = actorRef ! msg
}
@nraychaudhuri
nraychaudhuri / backpressure
Created August 6, 2014 18:08
back pressure
I try to put things into the larger perspective here, so prepare, long mail.
== Defining backpressure
First of all, we need a working definition of "backpressure". I put it in quotes since I will attack things from a very general perspective which might not exactly match what others think as backpressure.
Sometimes it is easier to characterize the correct behavior of a system/protocol by defining what we consider incorrect behavior rather than trying to limit ourselves when approaching from correctness properties. In the case of backpressure there are two undesireable kinds of behavior:
- If the buffers in the system might growth without bounds then the backpressure protocol is not safe
- If the protocol can become stuck, although the sender has messages to deliver and the receiver is also available to process them, then the backpressure protocol is not safe

The default SupervisorStrategy in Akka

At times it's hard to remember all the details of restarting a faulty actor. So lets take a look at a simple example:

/user/grand-parent/parent/child

Here we have a Child actor with one Parent and one GrandParent actor.

@nraychaudhuri
nraychaudhuri / slick_crud.scala
Created May 27, 2014 16:12
Generic CRUD for Slick1
package solution
import scala.slick.driver.ExtendedProfile
object DI {
object models {
sealed trait Model { def id: Option[Long] }
case class ModelA(a: String, id: Option[Long] = None) extends Model
case class ModelB(b: String, id: Option[Long] = None) extends Model