0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

超備忘録

Last updated at Posted at 2020-01-05

Google Driveでショートカットを作成

フォルダを選択して「Shift+Z」

拡張子を削除

${filename%.*}

数字にマッチするワイルドカード

*-+([0-9]).pdf

PDF をページ分割

pdfseparate original.pdf out-%02d.pdf

ログファイルを日時で名前付け

`date +%Y%m%d_%H%M%S`.log
`date +%y%m%d_%H%M%S`.log

好きなログフォーマット

basicConfig(
    level=20,
    format="[%(levelname).1s|%(asctime).19s] %(message)s"
)
basicConfig(
    level=20,
    format="[%(levelname).1s|%(asctime).19s] %(message)s",
    handlers=[StreamHandler(), FileHandler("logfile-path.log")]
)

パスワード付きZIPを作る

zip -rev zipfilename.zip file1 file2, ...

PyPI へアップロード

rm -r build dist *.egg-info   # second time or later
python setup.py sdist bdist_wheel
twine upload --repository pypi dist/*

Jupyter notebook のモジュールリロード設定

%load_ext autoreload
%autoreload 2

Jupyter でsys.pathの不足分を追加 (venv環境を認識しないときなど)

import sys
ps = !python -c "import sys; print('\n'.join(sys.path))"
for p in ps:
    if p not in sys.path:
        sys.path.append(p)
        print("Added '{}' to sys.path".format(p))

Jupyter notebook 補完機能回復

%config Completer.use_jedi = False

Python パッケージをPYPIへアップロード

python setup.py sdist bdist_wheel
twine upload dist/*

Gitで特定のSSH鍵を指定する

# clone
git -c core.sshCommand="ssh -i private_key_file" clone host:repo.git

# set to an existing local repo
git config core.sshCommand 'ssh -i private_key_file'

画像をリサイズ

convert <original file> -resize 96x96! <output file>

PDF -> PNG

pdftoppm -png -r 300 original.pdf output-prefix

Ubuntu, R package が依存するソフトウェア

sudo apt install libcurl4-openssl-dev libxml2-dev libssl-dev libfontconfig1-dev \\
  libcairo2-dev libgtk2.0-dev libcairo2-dev xvfb xauth xfonts-base \\
  libxt-dev libfftw3-dev libtiff5-dev libmagick++-dev

For

install.packages(c(
  "devtools", "magrittr", "dplyr", "ggplot2", "readr", "Rcpp", "openxlsx",
  "DBI", "RSQLite", "sqldf", "readxl", "combiter", "stringr", "striprtf",
  "reshape2", "tidyr", "ggiraphExtra", "GGally", "ggfortify", "gridExtra",
  "IRkernel", "testthat", "imager", "gitlabr", "RSelenium",
  "tidyverse", "robotstxt", "magick"
))
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?