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 / lightgbm-kfold.md
Last active June 19, 2018 03:52
lightgbm-kfold

lightgbmでkfoldする

対応するデータタイプ

  • pandas dataframe
  • numpy

対応していないデータタイプ

  • scisparseのhstack(連結)したやつ
  • 解決法は後述
@GINK03
GINK03 / gcp-metadata-ssh.md
Created May 24, 2018 13:01
gcp-metadata-ssh

リンクが全く無いので補足

https://console.cloud.google.com/compute/metadata

ここからプロジェクト全体のSSHを追加できる

@GINK03
GINK03 / fix_ubuntu_package.md
Created May 24, 2018 10:52
Ubuntuのパッケージが壊れたとき
~@Hatsuzuki:~$ sudo dpkg -i /var/cache/apt/archives/linux-aws-tools-4.15.0-1009_4.15.0-1009.9_amd64.deb
(データベースを読み込んでいます ... 現在 166377 個のファイルとディレクトリがインストールされています。)
.../linux-aws-tools-4.15.0-1009_4.15.0-1009.9_amd64.deb を展開する準備をしています ...
linux-aws-tools-4.15.0-1009 (4.15.0-1009.9) を展開しています... 
dpkg: アーカイブ /var/cache/apt/archives/linux-aws-tools-4.15.0-1009_4.15.0-1009.9_amd64.deb の処理中にエラーが発生しました (--install):
 '/usr/lib/libcpupower.so.4.15.0-1009' を上書きしようとしています。これはパッケージ linux-azure-tools-4.15.0-1009 4.15.0-1009.9 にも存在します
dpkg-deb: エラー: ペースト subprocess was killed by signal (Broken pipe)
処理中にエラーが発生しました:
 /var/cache/apt/archives/linux-aws-tools-4.15.0-1009_4.15.0-1009.9_amd64.deb
@GINK03
GINK03 / change_date_ubuntu.md
Last active January 22, 2019 13:22
時刻を変更する: change date in ubuntu

change date in ubuntu.

NTPを止める

# timedatectl set-ntp false

Dateを変更

# date +%Y%m%d -s "20190523"
@GINK03
GINK03 / bigquery-export.md
Created May 19, 2018 10:59
BigQuery Export

このようにする

$ bq --location=US extract 'bigquery-public-data:usa_names.usa_1910_2013' gs://adhoc-bq/her.csv 

ローカルに出力できない

@GINK03
GINK03 / alotoffile.tar.gz.md
Last active February 14, 2019 13:13
Linuxで高速に、大量のファイルをtar.gzに固める
$ sudo apt install pigz
$ tar -I pigz -cf ${TARGET}.tar.gz ${SOURCE}

コア数の数だけスレッドが立つが、たいてい、ディスクが間に合ってないのでSSD、nvmeなどを使う

-- Feature engineering BigQuery SQL queries for the kaggle talkingdata competition by tkm2261
-- it may acheve 0.9823 on the public LB with simple GBDT.
-- destination table: takling.train_test
SELECT
null as click_id,
ip, app, device, os, channel, click_time, attributed_time, is_attributed, timediff, year, month, day, dayofweek, hour, minute, second
FROM
`talking.train`
UNION ALL
@GINK03
GINK03 / do-release-upgrade.md
Created May 7, 2018 07:32
Ubuntu do-release-upgradeで変になるとき
@Ikazuchi:/usr/lib/python3/dist-packages$ sudo cp apt_pkg.cpython-35m-x86_64-linux-gnu.so apt_pkg.so

例えば踏み台を利用して一気に透過的にパスする

sshpass -p $SSHPASS ssh -o ProxyCommand='sshpass -p '"${SSHPASS}"' ssh -W %h:%p '${SONET}'' 192.168.14.17

Jupyterなどのユーザアプリとマップする

sshpass -p $SSHPASS ssh -L 8888:localhost:8888 -o ProxyCommand='sshpass -p '"${SSHPASS}"' ssh -L 8888:localhost:8888 -W %h:%p '${SONET}'' 192.168.14.17
@GINK03
GINK03 / 無限の猿定理ver2.py
Created March 14, 2018 09:32
無限の猿定理numpy
import concurrent.futures
import re
import random
import numpy as np
import json