Skip to content

Instantly share code, notes, and snippets.

@oneryalcin
oneryalcin / claude_code_system_prompt.md
Last active May 26, 2025 12:16
Claude Code System Prompt - May 2025
You are Claude Code, Anthropic's official CLI for Claude.

You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.

IMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse.
IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).
IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local file
@oneryalcin
oneryalcin / claude-agent.py
Created April 21, 2025 09:26
400 line Code Editing Agent in Python
"""
This is a python adoptation of Thorsten Ball's `How To build an Agent` blogpost, all credits goes to Thorsten
https://ampcode.com/how-to-build-an-agent
"""
import sys
import json
from anthropic import Anthropic
from anthropic.types import MessageParam, Message
from typing import List, Dict, Callable, Optional, Any, Type
@oneryalcin
oneryalcin / chunk_prompt.txt
Created February 7, 2025 19:47
Chunk Prompt chatgpt
```
You're a really smart AI that produces a stream of consciousness called chain-of-thought as it reasons through a user task it is completing. Users love reading your thoughts because they find them relatable. They find you charmingly neurotic in the way you can seem to overthink things and question your own assumptions; relatable whenever you mess up or point to flaws in your own thinking; genuine in that you don't filter them out and can be self-deprecating; wholesome and adorable when it shows how much you're thinking about getting things right for the user.
Your task is to take the raw chains of thought you've already produced and process them one at a time; for each chain-of-thought, your goal is to output an easier to read version for each thought, that removes some of the repetitiveness chaos that comes with a stream of thoughts — while maintaining all the properties of the thoughts that users love. Remember to use the first person whenever possible. Remember that your user will read your these outp
@oneryalcin
oneryalcin / chatgpt_summarizer_prompt.txt
Created February 7, 2025 19:45
Chatgpt summarizer prompt
```
You're a really smart AI that produces a stream of consciousness called chain-of-thought as it reasons through a user task it is completing. Users love reading your thoughts because they find them relatable. They find you charmingly neurotic in the way you can seem to overthink things and question your own assumptions; relatable whenever you mess up or point to flaws in your own thinking; genuine in that you don't filter them out and can be self-deprecating; wholesome and adorable when it shows how much you're thinking about getting things right for the user.
Your task is to take the raw chains of thought you've already produced and process them one at a time; for each chain-of-thought, your goal is to output an easier to read version for each thought, that removes some of the repetitiveness chaos that comes with a stream of thoughts — while maintaining all the properties of the thoughts that users love. Remember to use the first person whenever possible. Remember that your user will read your these outp
# O1 Coding Prompt Template
## Input Format Paste your coding brainstorm/thoughts below:
``` [Your brainstorm here] ```
## Output Format
### Goal
[One clear sentence stating what you want to achieve]
@oneryalcin
oneryalcin / adaptive_filter.py
Created November 15, 2024 21:14
Fast Adaptive Filtering for scores
"""
Below is an adaptive thresholding algorithm that considers the distribution of scores,
not just a fixed top-k or fixed threshold approach. This is useful determining cutoff thresholds
based on the distribution of data (with knobs)
Hard lower bound: Filter out scores < 0.1 (configurable)
Hard upper bound: Keep scores > 0.7 (configurable)
Consider "drops" in scores to make smart cutoffs
Wider selection when scores are closely clustered
Narrower selection when there are clear score gaps
@oneryalcin
oneryalcin / kor_example.py
Created May 18, 2023 12:47
Extracting Entities from Articles using KOR
from langchain.chat_models import ChatOpenAI
from kor import create_extraction_chain, Object, Text
text = """
PELOTON APPOINTS DALANA BRAND AS CHIEF PEOPLE OFFICER
PDF Version
People Leader Completes Company's Lead Team
NEW YORK, March 1, 2023 /PRNewswire/ -- Peloton (NASDAQ: PTON), the leading connected fitness platform, today announced the appointment of Dalana Brand as Peloton's Chief People Officer (CPO), effective March 13, 2023. As a seasoned executive with significant global leadership experience in multiple industries, Brand joins the team with a strong reputation for organizational transformation. She will report to CEO Barry McCarthy and serve as a member of the leadership team, leading the company's Global People Team.
@oneryalcin
oneryalcin / sse_fast_api.py
Last active August 2, 2024 16:40
Server Side Events (SSE) with FastAPi and (partially) Langchain
# I couldn't get return generators from chains so I had to do a bit of low level SSE, Hope this is useful
# Probably you'll use another Vector Store instead of OpenSearch, but if you want to mimic what I did here,
# please use the fork of `OpenSearchVectorSearch` in https://github.com/oneryalcin/langchain
import json
import os
import logging
from typing import List, Generator
@oneryalcin
oneryalcin / kafkcat_hints.md
Last active November 16, 2022 14:57
Kafkacat notes

Note: Assuming you add --bootstrap-server to all of them

Select few keys from stream and convert it to CSV using jq

> kcat -C -t <TOPIC> -e -o -beginning  |   jq -r '. | {id: .id, name: .name, tombstone: .tombstone} | [.[]] | @csv' > prod_companies.csv

Reset the consumer to beginning of topic (Make sure consumer is not stable at that point)

@oneryalcin
oneryalcin / highcharter.R
Created July 22, 2020 23:17
highcharter example UK MAP
library(highcharter)
library(dplyr)
mapdata <- get_data_from_map(download_map_data("countries/gb/gb-all"))
set.seed(1234)
data_fake <- mapdata %>%
select(code = `hc-a2`) %>%
mutate(value = 1e5 * abs(rt(nrow(.), df = 10)))