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 magit-mode-setup-return-buffer (mode &rest args) | |
"Setup up a MODE buffer using ARGS to generate its content." | |
(let ((buffer (magit-mode-get-buffer mode t)) | |
(section (magit-current-section))) | |
(with-current-buffer buffer | |
(setq magit-previous-section section) | |
(setq magit-refresh-args args) | |
(funcall mode)) | |
(magit-display-buffer buffer) | |
(with-current-buffer buffer |
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
! font | |
URxvt.allow_bold: false | |
URxvt*font: xft:RictyDiminishedDiscord-Regular:size=14:antialias=true | |
! Cursor | |
URxvt.cursorBlink: true | |
URxvt.cursorColor: #657b83 | |
URxvt.cursorUnderline: false | |
! setting |
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
;; zone-pgm-rainbow | |
(defun decimal->hex (n) | |
(format "%02X" n)) | |
(defun hsv->rgb (h s v) | |
(let ((h (max 0 (min 360 h))) | |
(s (/ (max 0 (min 100 s)) 100.0)) | |
(v (/ (max 0 (min 100 v)) 100.0))) | |
(if (= 0 s) |
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 hoge.core | |
(:require [qbits.spandex :as s])) | |
;; 参考: https://dev.classmethod.jp/server-side/elasticsearch-getting-started-07/ | |
(def conn (s/client {:hosts ["http://localhost:9200"]})) | |
;; clusterの状態確認 | |
(s/request conn {:url "/_cat/health?v"}) |
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
;;; https://nlp100.github.io/ja/ch01.html | |
;; helper | |
(defn get-words [s] | |
(->> (clojure.string/split s #"[\., ]") | |
(filter #(not (empty? %))))) | |
(defn make-ngram [n coll] | |
(if (> n (count coll)) | |
[] |
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 | |
# https://nlp100.github.io/ja/ch02.html | |
# 10 | |
cat popular-names.txt | bb -io "(count *input*)" | |
# 11 | |
cat popular-names.txt | bb -i '(doseq [line *input*] (println (str/replace line #"\t" " ")))' > popular-names-spaces.txt |
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 gengo03 | |
(:require [cheshire.core :as cheshire] | |
[clojure.java.io :as io])) | |
;; https://nlp100.github.io/ja/ch03.html | |
;; 20 | |
(def r (io/reader (io/resource "jawiki-country.json"))) | |
(def jsons (doall | |
(map (fn [line] |
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 gengo04 | |
(:require [clojure.java.io :as io] | |
[incanter.core :as incanter-core] | |
[incanter.charts :as incanter-charts] | |
)) | |
;; https://nlp100.github.io/ja/ch04.html | |
;; $ mecab neko.txt -o neko.txt.mecab |
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 gengo05 | |
(:require [clojure.java.io :as io] | |
[incanter.core :as i-core] | |
[incanter.charts :as i-charts] | |
[dorothy.core :as dot] | |
[dorothy.jvm :refer (render save! show!)])) | |
;; https://nlp100.github.io/ja/ch05.html | |
;; $ cat neko.txt | cabocha -f1 > neko.txt.cabocha |
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 re-seq (r s) | |
(let ((l) | |
(n 1) | |
(break nil)) | |
(save-match-data | |
(string-match r s) | |
(while (null break) | |
(if-let ((m (match-string n s))) | |
(progn | |
(push m l) |