javascript版jupyterのようなobservable
observableはjavascript版のjupyterのようなサービス. d3.jsを利用した美しい可視化が特徴的.
どうやら今年の1月31日にサービスインしたらしい.
Hello, world! 🎉 Announcing Observable notebooks: a better way to code, discover, and communicate. https://t.co/qfdZ1fyiR6
— Observable (@observablehq) 2018年1月31日
ここから基本的なサンプルを色々見ることができる. jupyterと正面から勝負するのは大変そうな気もするけど、出力となるノートはobservableの方がきれいなので注目している.
ちなみに、d3.expressというURLからも飛ぶことができる.
Everlaneの海外配送が無料になってる
emacsでカーソル位置の単語をispellの辞書に追加する
emacsでカーソル位置の単語をispellの辞書に追加するelispコード
(require 'thingatpt) (defun add-word-to-ispell-dictionary () "Add word to dictionary file for ispell." (interactive) (let ((user-dictionary-file (expand-file-name "~/.aspell.en.pws"))) (let ((buf (find-file-noselect user-dictionary-file))) (if (not (file-exists-p user-dictionary-file)) (with-current-buffer buf (insert "personal_ws-1.1 en 0\n") (save-buffer))) (let ((theword (thing-at-point 'word))) (if theword (with-current-buffer buf (goto-char (point-max)) (insert (format "%s\n" theword)) (save-buffer)))) ))) (global-set-key "\M-." 'add-word-to-ispell-dictionary)
emacsでカーソル位置の数字を上下させる
emacsでカーソル位置の数字を上下させるemacs lispコード. どこかから拾ってきたのかもしれないもの. 意外と便利.
(defun increment-number-at-point () "Increase number at current cursor." (interactive) (skip-chars-backward "0123456789") (or (looking-at "[0123456789]+") (error "No number at point")) (replace-match (number-to-string (1+ (string-to-number (match-string 0)))))) (defun decrement-number-at-point () "Decrease number at current cursor." (interactive) (skip-chars-backward "0123456789") (or (looking-at "[0123456789]+") (error "No number at point")) (replace-match (number-to-string (1- (string-to-number (match-string 0)))))) (global-set-key (kbd "C-c C-+") 'increment-number-at-point) (global-set-key (kbd "C-c C--") 'decrement-number-at-point)
ambie + TT-BR06が悪くない
ambieは耳をふさがないイヤホンということで周囲の音が聞きやすいということを売りに出されているイヤホンだ.
もともとはイヤホンジャックを備えている有線イヤホンとして販売されていた.
先日Bluetoothによって無線化された新製品が発売された.
しかしこの新製品、いくつかの残念な点がある.
- Bluetooth 3.0
- 連続再生時間が6時間
個人的には旧有線ambieにtaotronicsのTT-BR06というBluetooth レシーバをつけて利用している.
このTT-BR06という製品の素晴らしいところは
- 連続再生時間が15時間(!)
- 充電しながら利用できる
という2点である. また、Bluetooth 4.1なのでBluetooth 3.0の無線ambieに比べるとその点においても良い.
micropythonでm5stackをwifiにつなげる
m5stackでmicropythonを使ってwifiを利用するときは, wifisetup
を利用すれば簡単に実装できる.
import wifisetup
ただ、再接続などを実現するためにどうしても自前で実装したかったので試してみた.
from m5stack import lcd import utime import network def connect_wifi(target_ssid, target_passwd, timeout_sec=10): wlan = network.WLAN(network.STA_IF) # create station interface wlan.active(True) # activate the interface for net in wlan.scan(): ssid = net[0].decode() if ssid == target_ssid: lcd.println('Connecting to ' + ssid) wlan.connect(ssid, target_passwd) start_date = utime.time() while not wlan.isconnected(): now = utime.time() lcd.print('.') if now - start_date > timeout_sec: break utime.sleep(1) if wlan.isconnected(): lcd.println('Success to connect') return True else: lcd.println('Failed to connect') return False return False
helm-miniのデフォルト値にカーソルのシンボルが渡ってしまう
helm-mini
をC-x b
に割り振ってバッファ選択に使っているのだが、現在のカーソルがある位置のシンボル(いわゆるthing-at-point
)がデフォルトで渡ってしまい、バッファの選択に不自由していた.
どうやら, helm
関数の:default
キーワードを与えないと、thing-at-pointがデフォルトとして
渡ってしまう。:default
がnil
だとだめなので、空文字列を渡すようにすればいい.
(defun my-helm-mini () "Customized version of helm-mini in order to disable 'thing-at-point'." (interactive) (require 'helm-x-files) (unless helm-source-buffers-list (setq helm-source-buffers-list (helm-make-source "Buffers" 'helm-source-buffers))) (helm :sources helm-mini-default-sources :buffer "*helm mini*" :default "" ;; important :ff-transformer-show-only-basename nil :truncate-lines helm-buffers-truncate-lines)) (define-key global-map (kbd "C-x b") 'my-helm-mini)