Skip to content

Instantly share code, notes, and snippets.

View kapilreddy's full-sized avatar

Kapil Reddy kapilreddy

View GitHub Profile
@kapilreddy
kapilreddy / opengraph.clj
Last active November 11, 2024 09:05
RFC - Clojure library opengraph list
{:lib/name "reitit"
:composes-with {"ring" {:purpose "HTTP server"}
"muuntaja" {:purpose "Content negotiation"}}
:supports {:metrics ["prometheus" "dropwizard"]
:logging ["timbre" "log4j"]
:tracing ["opentelemetry" "brave"]}
:performance {:blocking? false ;; Non-blocking by default
:thread-safety :immutable ;; Thread-safe due to immutability
:memory-footprint :medium ;; Route compilation uses memory
:startup-impact :medium ;; Route compilation at start
@kapilreddy
kapilreddy / young_software_engineer.md
Last active December 17, 2022 18:21
Young software engineer basics

Hello! This document is for young software engineers. The goal of this document is to provide a foundation (and not overwhelm you).

Developer environment

A good dev environment is a great foundation to build and learn bigger things. Before learning any tech you should invest some time learning these basics. Treat this as if you are setting up your study table.

Shell

The shell is one of the most basic (and very powerful) ways to interact with your computer. This is where all the interesting things will start and end when you are writing software.

Resources:

@kapilreddy
kapilreddy / emacs_text_movement.js
Last active August 15, 2021 18:57
Emulate Emacs text editing in browser
// ==UserScript==
(function () {
'use strict';
let nowPlayingClassName = 'now-playing-tracklist-row'
let buffer = [];
let bindings = [
{binding: ["control", "f"], action: moveForward},
{binding: ["control", "b"], action: moveForward}
@kapilreddy
kapilreddy / shoot_a_short_2019.md
Last active January 21, 2019 10:55
Shoot a short workshop list of things/links/people
@kapilreddy
kapilreddy / info.clj
Created November 18, 2018 04:55
Info middleware change to support protocol code navigation
(defn info
[{:keys [ns symbol class member] :as msg}]
(let [[ns symbol class member] (map u/as-sym [ns symbol class member])]
(if-let [cljs-env (cljs/grab-cljs-env msg)]
(info-cljs cljs-env symbol ns)
(let [var-info (cond (and ns symbol) (clj-info/info ns symbol)
(and class member) (clj-info/info-java class member)
:else (throw (Exception.
"Either \"symbol\", or (\"class\", \"member\") must be supplied")))
;; we have to use the resolved (real) namespace and name here
ABC
No previous messages
Open chat and Add message -> New Issue
New Issue
Agent sends message -> Issue in progress
User sends message -> New Issue
User deletes thread -> No previous messages
Issue in progress
Agent sends message -> Issue in progress
User sends message -> Issue in progress
Kaioken
Initialize Kaioken
Message received -> Consume messages
Consume messages
Message received -> Consume messages
Enough messages received -> Bulk start
Bulk start
Bulk success -> Consume messages
Retriable error -> Bulk start
Non-recoverable error -> Exit
Kaioken
Initialize Kaioken
Message received -> Consume messages
Consume messages
Message received -> Consume messages
Enough messages received -> Bulk start
Bulk start
Data store - Success response -> Bulk success
Data store - Retriable error -> Bulk start
@kapilreddy
kapilreddy / find-offsets.clj
Last active April 12, 2017 11:32
Kafka message offset finder
;; project.clj
;; [clj-time "0.6.0"]
;; [org.clojure/data.json "0.2.4"]
;; [clj-kafka "0.2.8-0.8.1.1"]
;; Utility to find offsets in a given Kafka topic for a given
;; cursor/point in time. The code assumes that each message has a
;; monotonically increasing number (ex. unix timestamp) associated with
;; it.
@kapilreddy
kapilreddy / kafka-core-async.clj
Last active August 29, 2015 14:10
Core.async message consumer with safe shutdown
(ns core-async-kafka.core
(:require [clojure.core.async :refer [chan buffer go >!! <!! <! close! sliding-buffer]]))
(defn process-message
[msg status-chan]
(>!! status-chan :in-progress)
(Thread/sleep (rand-int 10000))
(println (format "Consumed %s message" msg))
(>!! status-chan :sucess))