Skip to content

Instantly share code, notes, and snippets.

@anandwana001
anandwana001 / gist:ed9209aa627dd43fbb37a9d2d9127ede
Created November 7, 2026 04:07
Gemini Omni 1.2 Flash Diwali Prompt
Create a cinematic, ultra-realistic 15-second Diwali celebration video using my uploaded selfie, diya photograph, and voice reference.
**Video format:** Vertical 9:16, 720p, cinematic lighting, realistic visuals.
**Scene 1 (0–3 seconds):** Begin with an extreme close-up of a glowing diya. The flame flickers naturally. Slowly zoom out to reveal a beautiful, colorful Indian rangoli surrounded by marigold flowers and dozens of illuminated diyas.
**Scene 2 (3–7 seconds):** Transition into a beautifully decorated Indian courtyard at night. Golden fairy lights sparkle, colorful phuljharis illuminate the background, and the camera moves smoothly through the festive atmosphere.
**Scene 3 (7–12 seconds):** Show me standing in the courtyard wearing an elegant traditional kurta. Preserve my exact facial appearance from the uploaded selfie. I look directly at the camera, smile naturally, and say in a warm Indian accent:

Privacy Policy

This privacy policy applies to the Ram Shalaka app for mobile devices, together with any related services operated by Akshay Nandwana (collectively, the "Application"). Akshay Nandwana is hereby referred to as the "Service Provider".

Information Collection and Use

The Application collects information when you download and use it. This information may include information such as

  • Your device's Internet Protocol address
  • The pages of the Application that you visit, the time and date of your visit, the time spent on those pages
// ❌ Wrong: CPU-intensive work on IO dispatcher
suspend fun processData(data: List<Int>) = withContext(Dispatchers.IO) {
data.map { it * it * it * it } // CPU-intensive
}
// ✅ Correct: CPU-intensive work on Default dispatcher
suspend fun processData(data: List<Int>) = withContext(Dispatchers.Default) {
data.map { it * it * it * it }
}
// ❌ Wrong: Network call on Default dispatcher
suspend fun fetchData() = withContext(Dispatchers.Default) {
// ❌ Wrong: Blocking call without withContext
suspend fun badExample() {
Thread.sleep(1000) // Blocks the thread!
}
// ✅ Correct: Use delay for coroutines
suspend fun goodExample() {
delay(1000) // Suspends without blocking
}
// ✅ Correct: Use withContext for blocking calls
suspend fun blockingOperation() = withContext(Dispatchers.IO) {
class DataProcessor {
suspend fun processAllData(items: List<String>): List<String> = coroutineScope {
// All child coroutines will complete before returning
items.map { item ->
async(Dispatchers.Default) {
processItem(item)
}
}.awaitAll()
}
import kotlinx.coroutines.*
import kotlin.system.measureTimeMillis
suspend fun performanceTest() {
val data = List(1000) { it }
// Sequential processing
val sequentialTime = measureTimeMillis {
data.forEach { item ->
delay(10)
// process item
import kotlinx.coroutines.*
import java.util.concurrent.Executors
class DatabaseService {
// Custom dispatcher with limited threads matching DB connection pool
private val dbDispatcher = Executors.newFixedThreadPool(5).asCoroutineDispatcher()
data class QueryResult(val data: List<String>)
suspend fun executeQuery(query: String): QueryResult = withContext(dbDispatcher) {
println("Executing '$query' on ${Thread.currentThread().name}")
import java.util.concurrent.Executors
class CustomDispatchers {
// Single-threaded dispatcher for sequential processing
val singleThread = Executors.newSingleThreadExecutor().asCoroutineDispatcher()
// Fixed thread pool
val fixedThreadPool = Executors.newFixedThreadPool(4).asCoroutineDispatcher()
// Cached thread pool (creates threads as needed)
val cachedThreadPool = Executors.newCachedThreadPool().asCoroutineDispatcher()
import kotlinx.coroutines.*
import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withPermit
import kotlin.system.measureTimeMillis
class RateLimitedApiClient {
private val maxConcurrentRequests = 10
private val semaphore = Semaphore(maxConcurrentRequests)
suspend fun makeApiCall(id: Int): String = semaphore.withPermit {
withContext(Dispatchers.IO) {
import kotlinx.coroutines.*
import kotlin.system.measureTimeMillis
data class ScrapedData(val url: String, val title: String, val contentLength: Int)
class WebScraper {
suspend fun scrapeWebsite(url: String): ScrapedData = withContext(Dispatchers.IO) {
println("Scraping $url on ${Thread.currentThread().name}")
delay(500) // Simulate network request
ScrapedData(
url = url,