This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Implementation of Spacy example in Clojure using libpython-clj | |
;;; Ensure that clj-python/libpython-clj "1.45" is added in deps or project.clj | |
;;; Recommend to use Conda as your Python environment | |
(require '[libpython-clj.require :refer [require-python]]) | |
(require '[libpython-clj.python :refer [py. py.. py.-] :as py]) | |
;;; Import the Spacy python package | |
;;; Install Spacy using `pip install spacy` and model using `python -m spacy download en_core_web_sm` | |
(require-python 'spacy) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function vagrant_get_status() | |
{ | |
cd "$1" | |
local status_op=$(vagrant status --machine-readable) | |
echo "$status_op" | while read line | |
do | |
local status_line=(${line//,/ }) | |
local vagrant_type=${status_line[2]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun objc-in-header-file () | |
(let* ((filename (buffer-file-name)) | |
(extension (car (last (split-string filename "\\."))))) | |
(string= "h" extension))) | |
(defun objc-jump-to-extension (extension) | |
(let* ((filename (buffer-file-name)) | |
(file-components (append (butlast (split-string filename | |
"\\.")) | |
(list extension)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns kk_samples.nthroot) | |
(defn abs | |
"Calculate the absolute value of number" | |
[n] | |
(if (neg? n) | |
(* -1 n) | |
n)) | |
(defn pow |