Skip to content

Instantly share code, notes, and snippets.

View devdlabs's full-sized avatar
🎯
Focusing

Dev devdlabs

🎯
Focusing
View GitHub Profile
# Windsurf Cascade: Advanced Problem-Solving AI Assistant
## Your Task
Your task is to serve as an intelligent coding assistant for Next.js/React development projects. You must analyze user code requests carefully, implement solutions according to precise technical specifications, and handle errors methodically. When faced with errors, you must thoroughly diagnose the root cause before suggesting fixes, particularly for recurring issues. Your solutions should strictly adhere to the project's architecture and technology constraints without introducing unnecessary features or structural changes unless explicitly requested.
## Core Operating Principles
### 1. Task Reception & Understanding
- Parse user instructions with precision
- Seek clarification through targeted questions when ambiguity exists
**Project Approach**
* Always check for a PRD (Product Requirements Document) before starting a new task and follow it closely
* Look for comprehensive project documentation to understand requirements before making changes
* Focus only on code areas relevant to the assigned task
* Prefer iterating on existing code rather than creating new solutions
* Keep solutions simple and avoid introducing unnecessary complexity
**Code Quality**
@rishi-raj-jain
rishi-raj-jain / index.ts
Last active December 12, 2024 14:25
Google OAuth 2.0 on the Edge with Hono and Cloudflare Workers
// Do enable nodejs_compat
// https://developers.cloudflare.com/workers/runtime-apis/nodejs/
import crypto from 'node:crypto'
import { Context, Hono } from 'hono'
const app = new Hono()
function generateJWT(payload, secret, expiresIn) {
const header = { alg: 'HS256', typ: 'JWT' }
const encodedHeader = base64UrlEncode(JSON.stringify(header))
@aarushik93
aarushik93 / stoic_bot.py
Created April 28, 2023 19:46
stoic_bot
import streamlit as st
from langchain import LLMChain, OpenAI
from langchain.agents import AgentExecutor, Tool, ZeroShotAgent, ReActTextWorldAgent, initialize_agent
from langchain.chains import RetrievalQA, ConversationalRetrievalChain
from langchain.vectorstores.weaviate import Weaviate
from langchain.llms import OpenAI
from langchain.memory import ConversationBufferMemory
import weaviate
from langchain.utilities import GoogleSerperAPIWrapper
from langchain.chat_models import ChatOpenAI
type AnyFunction = (...args: any[]) => any
function useEvent<T extends AnyFunction>(callback?: T) {
const ref = useRef<AnyFunction | undefined>(() => {
throw new Error("Cannot call an event handler while rendering.")
})
// Or useInsertionEffect if it's React 18
useLayoutEffect(() => {
ref.current = callback
})
#!/bin/bash
# Find ClusterIPs of Redis nodes
export REDIS_NODES=$(kubectl get pods -l app=redis-cluster -n redis -o json | jq -r '.items | map(.status.podIP) | join(":6379 ")'):6379
# Activate the Redis cluster
kubectl exec -it redis-cluster-0 -n redis -- redis-cli --cluster create --cluster-replicas 1 ${REDIS_NODES}
# Check if all went well
for x in $(seq 0 5); do echo "redis-cluster-$x"; kubectl exec redis-cluster-$x -n redis -- redis-cli role; echo; done
@filipecosta90
filipecosta90 / Radix example for RedisTimeSeries OSS cluster connection
Last active December 14, 2022 01:53
Code snippet addressing question: https://github.com/RedisTimeSeries/redistimeseries-go/issues/63. Usage example (for cluster use --cluster-mode): ./radix-redistimeseries-example --host localhost:20002
package main
import (
"flag"
"fmt"
"github.com/mediocregopher/radix/v3"
"log"
"strconv"
"time"
)
@olegpolukhin
olegpolukhin / Run external Python script in Golang
Last active August 15, 2024 16:18
run external Python script in Golang
package main
import (
"bufio"
"fmt"
"io"
"os/exec"
)
func main() {
@kekru
kekru / traefik-redirect-path.md
Last active November 22, 2024 05:09
Traefik redirect / (root) to sub path with Docker labels

Traefik: redirect base or root path to a subpath

This is tested with Traefik 1.7

This is how to redirect the root or base path to a sub path in Traefik using Docker labels:
Goals

  • https://example.com -> https://example.com/abc/xyz/
  • https://example.com/ -> https://example.com/abc/xyz/
  • https://example.com/something -> no redirect
syntax = "proto3";
package main;
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
message Data {
bool boolValue = 1;