Skip to content

Instantly share code, notes, and snippets.

View kapilreddy's full-sized avatar

Kapil Reddy kapilreddy

  • Helpshift
  • Pune, India
View GitHub Profile
@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))
(defn divide-coll
"Divide collection of block heights into regions where water will be blocked.
ex.
[1 2 0 1 3 2 1 0 3] -> [[3 2 1 0 3] [2 0 1 3]]"
[c]
(let [regions (reduce (fn [coll i]
(cond
(seq coll) (let [[x & xs] coll
from (first x)
new-x (conj (vec x) i)]