Skip to content

Instantly share code, notes, and snippets.

View esshka's full-sized avatar
🏠
Working from home

Eugeny esshka

🏠
Working from home
View GitHub Profile
@esshka
esshka / dual_math.clj
Created April 8, 2025 02:18
clojure dual nums impl
(ns dual-math
(:refer-clojure :exclude [+ - * / abs max min sin cos tan asin acos atan exp log pow sqrt])
(:require [clojure.core :as core]))
;; == Part 1: Dual Number Definition and Helpers ==
(defrecord DualNumber [value deriv])
;; Helper to check if something is a dual number
(defn dual? [x] (instance? DualNumber x))
@esshka
esshka / coding-agent.py
Created April 3, 2025 16:27 — forked from Madhav-MKNC/coding-agent.py
All the code you need to create a powerful agent that can create and edit any file on your computer using the new text_editor tool in the Anthropic API.
import anthropic
import os
import sys
from termcolor import colored
from dotenv import load_dotenv
class ClaudeAgent:
def __init__(self, api_key=None, model="claude-3-7-sonnet-20250219", max_tokens=4000):
"""Initialize the Claude agent with API key and model."""
@esshka
esshka / tree_generator.clj
Created March 24, 2025 08:27
Clear, hierarchical representation of both the file structure and namespaces
(ns tree-generator
(:require [clojure.java.io :as io]
[clojure.string :as str]))
(defn relative-path
"Computes the relative path of a file with respect to a base directory."
[base file]
(let [base-path (.getCanonicalPath base)
file-path (.getCanonicalPath file)
prefix (str base-path "/")]
@esshka
esshka / candles.html
Created March 20, 2025 07:17
simple candlesticks price chart on canvas
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Candlestick Chart</title>
<style>
/* Basic styles for the container and canvas */
body {
font-family: 'Arial', sans-serif;
@esshka
esshka / clojure_swe.txt
Created February 24, 2025 14:13
Clojure SWE REPL-driven prompt
Objective: Develop a Clojure application using REPL-driven development.
Instructions:
Start with small, fundamental functions:
Identify the core features or functionalities required for your application.
Break each feature down into the smallest, most basic functions that can be developed and tested independently.
Write and test in the REPL:
Write the code for each small function directly in the REPL (Read-Eval-Print Loop).
Test it thoroughly with a variety of inputs, including typical use cases and relevant edge cases, to ensure it behaves as expected.
@esshka
esshka / README.md
Created February 9, 2025 06:10 — forked from awni/README.md
Test Time Scaling with R1-based Models and MLX LM

Test Time Scaling with MLX LM and R1-based LLMs

Install MLX LM:

pip install mlx-lm

And run:

import json
import logging
import asyncio
import websockets
from typing import Dict, List, Optional, Set
from datetime import datetime
import hmac
import base64
import time
import redis
Understand the Task: Grasp the main objective, goals, requirements, constraints, and expected output.
- Minimal Changes: If an existing prompt is provided, improve it only if it's simple. For complex prompts, enhance clarity and add missing elements without altering the original structure.
- Reasoning Before Conclusions: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!
- Reasoning Order: Call out reasoning portions of the prompt and conclusion parts (specific fields by name). For each, determine the ORDER in which this is done, and whether it needs to be reversed.
- Conclusion, classifications, or results should ALWAYS appear last.
- Examples: Include high-quality examples if helpful, using placeholders [in brackets] for complex elements.
- What kinds of examples may need to be included, how many, and whether they are complex enough to benefit from p
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
public class UnsafeNN implements NN {
private final double[] z1;
private final double[] z2;
private final ByteBuffer bb;
private final DoubleBuffer db;
private final double[] o;
@esshka
esshka / rehuy.js
Created July 11, 2024 19:25
rehuy
const ctx = [];
function addEffect(current, effects) {
effects.add(current);
current.deps.add(effects);
}
function createAtom(value) {
const effects = new Set();