Skip to content

Instantly share code, notes, and snippets.

@pn11
pn11 / boost_Cpp_mac.md
Last active March 19, 2024 04:07
Mac で C++ のライブラリ boost を使う

Mac で C++ のライブラリ boost を使う

brew install boost

で 1.60.0_2 が入る。(2016/05/14)

/usr/local/Cellar/boost/1.60.0_2/include
@pn11
pn11 / TwitterRuby.md
Last active November 17, 2022 03:03
Ruby で Twitter API をいじる

5年ぶりくらいに Twitter API で遊んでみる。B4のときに遊んでた思い出。リアルタイムで Twitter 見てしまう依存症を治すためにログに保存しといてオフラインで見よう。 (ついでにリンクなども保存したい)

アクセストークンを取得

ググればやり方が出てくる。

Gem install

gem install twitter
@pn11
pn11 / tab_json2md.py
Last active September 29, 2022 15:09
Convert Chrome tab list extracted from Android into a Markdown and a OneTab-importable format.
# In advance, tabs.json have to be extracted via ADB by following way. (See https://android.stackexchange.com/a/199496/340082 for detail.)
# adb forward tcp:9222 localabstract:chrome_devtools_remote
# wget -O tabs.json http://localhost:9222/json/list
import json
with open('tabs.json') as f:
tabs = json.load(f)
with open('tabs.md', 'w') as f:
f.write(f"# {len(tabs)} tabs in your Android Chrome\n\n")
@pn11
pn11 / how-to-use-giza-pp.md
Last active July 8, 2022 05:59 — forked from mosmeh/how-to-use-giza-pp.md
GIZA++ の使い方

GIZA++ の使い方

GIZA++ は、統計的機械翻訳に使われるアライメントツールで、 IBM Model 1-5 と HMM を実装しています。今回は、Europarl Parallel Corpus で配布されている英独対訳コーパスのアライメントの尤度を推定させてみます。

セットアップ

# GIZA++ の準備
$ git clone https://github.com/moses-smt/giza-pp.git
$ cd giza-pp

$ make

@pn11
pn11 / pandas_font_color.ipynb
Last active April 19, 2022 10:53
pandas_font_color.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pn11
pn11 / CppUnixTime.md
Last active November 9, 2021 03:42
C++ で Unix time を扱う

C++ で Unix time を扱う

面倒なので unix time を扱うときは Ruby とかで書いていたのだけど、C++ で書かなければならなくなったので、改めてちゃんと調べた。ちゃんと調べても分かりにくい仕様だったので、めも。基本的には以下の2つを参照するのが良さそう。

サンプルコードを書いてみた。

@pn11
pn11 / tmux_and_xsel.md
Last active October 18, 2021 11:05
リモートのtmuxのコピーモードとクリップボードを共有する

リモートのtmuxのコピーモードとクリップボードを共有する

  • ローカルマシン: Mac (iTerm2)
  • リモートマシン: Linux (ROOT権限なし)

という状況でtmuxのコピーモードでコピーしてきたものをMacで扱いたい。

C-b zでズームしてからoptionキー押しながらマウスでコピーでもいいんだけど(iTerm2のみ?、ズームしないと複数行コピーするときに隣のペインも選択してしまう)、キーボードだけでやりたい。そこでxselを使う。

@pn11
pn11 / emacs-wrapper.sh
Created June 18, 2021 05:13
Do not open Emacs in VSCode Terminal
#!/bin/bash
if [ $TERM_PROGRAM = 'vscode' ]; then
code $*
else
exec emacsclient -t -a "" $*
fi
@pn11
pn11 / covid-19-Wako.ipynb
Last active May 2, 2021 12:02
covid-19-Wako.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pn11
pn11 / colab-ssh.ipynb
Last active January 23, 2021 12:04
ngrok を使って Google Colab に SSH ログインする。 cf. https://qiita.com/hazigin/items/c291adf5dc9ccc13d11f
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.