2018/03/10

[Python] Git bash から Python インタプリタ起動

Git bash 上から Python インタプリタを起動する
https://qiita.com/cointoss1973/items/a0da81df10f8cc04c83e

alias を ~/.bashrc に追記
alias python='winpty python.exe'

[WSL] Ubuntu と python 導入

Ubuntu インストール

1. Windows Store から Ubuntu インストール
2. unix ユーザー名、パスワード設定
3. sudo apt-get update
4. sudo apt-get upgrade

初期インストールされているのは python3 のみ
$ which python3
/usr/bin/python3
$ python
The program 'python' can be found in the following packages:
* python-minimal
* python3
Try: sudo apt install <selected package>

python3 用 pip dev のみインストール
$ sudo apt install python3-pip python3-dev

$ which pip3
/usr/bin/pip3
$ pip3 --version
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)

venvインストール
$ sudo apt install python3-venv

そのままでは Python3.6のインストール失敗
$ sudo apt install python3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.6
E: Couldn't find any package by glob 'python3.6'
E: Couldn't find any package by regex 'python3.6'

当面、3.5 のまま運用

というか、当面 git bash から Windows 版の Python(3.6)の方を利用する方針

というか、当面 git CMD から Windows 版の Python(3.6)の方を利用する方針

[Ubuntu] インストールされている Ubuntu のバージョンを確認

WSL のターミナルで確認
$ cat /etc/os-release

NAME="Ubuntu"
VERSION="16.04.3 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.3 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

uname は
$ uname -a
Linux [machinename] 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux

2018/03/06

[Visual Studio Code] タブキーで挿入される空白文字数を言語ごとに切り替える

Visual Studio Codeで言語ごとにインデントの設定をしたい
https://ja.stackoverflow.com/questions/34014/visual-studio-code%E3%81%A7%E8%A8%80%E8%AA%9E%E3%81%94%E3%81%A8%E3%81%AB%E3%82%A4%E3%83%B3%E3%83%87%E3%83%B3%E3%83%88%E3%81%AE%E8%A8%AD%E5%AE%9A%E3%82%92%E3%81%97%E3%81%9F%E3%81%84


Ctrl+Shift+Pで開くコマンドパレットにPreferences: Configure language specific settingsを入力/選択してユーザー用設定を開く。
編集対象の言語を入力/選択する。
{
    "[javascript]": {
        "editor.tabSize": 2
    },
    "[html]": {
        "editor.tabSize": 2,
    },
    "[css]": {
        "editor.tabSize": 2
    }
}
--

HTML, JavaScript, CSS は2タブ(2スペース)、その他は4タブ(4スペース)

2018/03/05

自動ページリローディングツール

LiveReload、LivePage ではなく、BrowserSync を npm から導入。

cd [websitebasedir]
browser-sync start --server --files *

で起動