Skip to content

Instantly share code, notes, and snippets.

View kirankulkarni's full-sized avatar

Kiran kirankulkarni

View GitHub Profile
@kirankulkarni
kirankulkarni / find-offsets.clj
Last active April 17, 2017 12:28 — forked from kapilreddy/find-offsets.clj
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.
@kirankulkarni
kirankulkarni / frequency.clj
Created August 18, 2011 19:27 — forked from kirankulkarni/frequency.clj
Get top 10 frequent words from file
(ns freq.core
(:import (java.io BufferedReader FileReader))
(:require [clojure.string :as string]))
(defn read-file-lazy
"Opens a file and creates a lazy-sequence to read each line"
[file-name]
(with-open [reader (BufferedReader. (FileReader. file-name))]
(line-seq reader)))