Skip to content

Instantly share code, notes, and snippets.

View GINK03's full-sized avatar
🌴
On vacation

catindog/nardtree GINK03

🌴
On vacation
View GitHub Profile
@GINK03
GINK03 / bert-pretrained-example.md
Created November 20, 2018 07:24
bert-pretrained-example.md
@GINK03
GINK03 / graphapi.md
Last active September 28, 2018 03:25
Facebookのgraphapi
@GINK03
GINK03 / dockerでファイルシステムをマウントして使う.md
Last active September 25, 2018 11:34
dockerでファイルシステムをマウントして使う.md

こんなふうになるものなるものらしい。

ホスト側のdb_dataはパーミッションを気にしなくてはならない!

 docker run -p 1022:22 -it \
  --mount type=bind,source="$(pwd)"/db_data,target=/db_data \
  --mount type=bind,source="$(pwd)"/db_sec,target=/db_sec \
  --mount type=bind,source="$(pwd)"/db_srb,target=/db_srb \
 nardtree/solid-scraper server.py 
@GINK03
GINK03 / lightgbm-kfold-nlp.md
Last active September 24, 2018 14:36
lightgbm-kfold-nlp
@GINK03
GINK03 / PDFの論文で改行を削除する.md
Created September 19, 2018 19:16
PDFの論文で改行を削除する(mac)

Google 翻訳利用時に英語論文のPDFにコピペする際の問題

PDFの改行をパースしてしまい、翻訳が適切に行われない

Macだと、以下のコマンドで、クリップボード領域のコピペ情報から、改行を消すことができる。

$ pbpaste |tr '\n' ' '| pbcopy

シェルスクリプトに書いておいて、登録しておくと便利

@GINK03
GINK03 / Linuxでパスワード認証をユーザ単位で無効化してssh認証にする.md
Created August 26, 2018 07:11
Linuxでパスワード認証をユーザ単位で無効化してssh認証にする

Private Keyを.ssh/authorized_keysに書き込む

$ dummy@Akatsuki:~/.ssh$ cat > authorized_keys
....hogehoge....

600permission

$ dummy@Akatsuki:~/.ssh$ chmod 600 authorized_keys
@GINK03
GINK03 / bisect.md
Created August 5, 2018 09:51
bisect

木系のアルゴリズム

bisect

O(n)で順序をソート維持しながらソートできる

ex

こんな感じ

insert indexが帰ってくる

@GINK03
GINK03 / lightgbm-gain.md
Created August 2, 2018 02:25
lightgbm-gain
def __getImp__(model):
    split = dict(zip(model.feature_name(), model.feature_importance('split')))
    split = pd.DataFrame.from_dict(split, orient='index')
    split.columns = ['split']
    
    gain = dict(zip(model.feature_name(), model.feature_importance('gain')))
    gain = pd.DataFrame.from_dict(gain, orient='index')
 gain.columns = ['gain']
@GINK03
GINK03 / ssh_short_cut.md
Created July 22, 2018 19:39
ssh short cut
#!/usr/bin/env python3
import os
import sys
import re

try:
  number = [arg for arg in sys.argv if re.search(r'^\d{1,}$', arg)][0]
  SSHKEY=os.environ['SSHKEY']
 os.system(f'sshpass -p "{SSHKEY}" ssh gimpei@192.168.14.{number}')
@GINK03
GINK03 / change_lr.md
Created July 22, 2018 16:08
change keras learning rate (change lr keras)
K.set_value(model.optimizer.lr, 0.001)