CentOS7最新パッケージにアップデート yum -y updateリブート rebootユーザー useradd passwd グループに追加 usermod -G ,

Minecraft | モブがわかないようにする

モブがわかないようにする /gamerule doMobSpawning false モブ、ドロップアイテム等を消す チビスライムやスライムボールも消すには何回か行う /kill @e[type=!Player]

Python | numpy.array でベクトル、行列の掛け算

>>> import numpy as np 1次元配列 x >>> x = np.array([1, 2, 3]) >>> x array([1, 2, 3]) >>> x.T # 縦ベクトル横ベクトルの区別はない array([1, 2, 3]) スカラー倍 ベクトルの和 各要素にスカラーを加える >>> 2 * x + [10, 20, 30] + 100 array([112, 1…

Python | numpy.matrix でベクトル、行列の演算

>>> import numpy as np # ベクトル >>> x = np.matrix([1, 0, 0]) >>> x # 横ベクトル matrix([[1, 0, 0]]) >>> x.T # 縦ベクトル matrix([[1], [0], [0]]) >>> 2 * x + [0, 3, 4] + 10 # スカラー倍とベクトルの和、各要素にスカラーを加える matrix([[12,…

Ubuntu | Magic Keyboard2 (US) right command を 日本語入力ON, left command を日本語入力OFF に設定する、かつcontrolキーとしても機能するようにする方法

目標と成果 右command 空打ちで日本語入力ON →成功 左command 空打ちで日本語入力OFF →成功 command キーはctrlキーとしても機能する →失敗 左ctrlキーを superキーに割り当てる →未実施 しかし下記の設定してもあまりうまくいっていない というか成功した2…

Ubuntu | Google Chrome のインストール

コマンドラインを使わずに .deb ファイルをダブルクリックしてインストールするのが良さそう

NVIDIA Driver install

slackware.jp www.ketsuago.com 5.4. Xorg の設定

Python | with 文が使える関数を作る

with 文が使える関数をつくる yield 式のところで with ブロックの内容が実行される #with_openthebook.py from contextlib import contextmanager class Book(): def __init__(self): self.contents = '' self.isopen = False def open(self): self.isopen …

Jupyter | configure jupyter qtconsole

jupyter qtconsole をフォント指定して起動 jupyter qtconsole --ConsoleWidget.font_family="MyricaM M" --ConsoleWidget.font_size=12

Python | pdb 対話的デバッガ

対話的デバッガ デバッグしたい部分に次の一文を挿入 import pdb; pdb.set_trace() (Pdb) プロンプトのコマンド(の例) プログラムを調べるコマンド w(here) スタックトレースを表示、矢印は現在のフレームを表す u(p) スコープを関数の呼び出し元に移す (o…

Python | python コードのテスト

unittest を使う # utils.py def to_hex(integer, length, byteorder, *, signed=False): b = integer.to_bytes(length, byteorder, signed=signed) lst = ['{:02X}'.format(x) for x in b] return ''.join(lst) # test_to_hex.py from unittest import Test…

Python | 2の補数 (signed) int ⇔ bytes ⇔ str (16進文字列)

(signed) int → bytes int.to_bytes を使う >>> (-100).to_bytes(1, byteorder='little', signed=True) b'\x9c' >>> (-1000).to_bytes(2, 'little', signed=True) b'\x18\xfc' >>> (-1000).to_bytes(2, 'big', signed=True) b'\xfc\x18' struct.pack を使う …

Python | 2の補数のビットパターンを文字列で得る方法

str.format を使う >>> '{:08b}'.format(-100 & 0xff) '10011100' >>> '{:02X}'.format(-100 & 0xFF) '9C' >>> '{:02X}'.format(-1000 & 0xFFFF) 'FC18' int.to_bytes を使う >>> b = (-100).to_bytes(1, byteorder='little', signed=True) >>> b b'\x9c' >>…

oyamazemi.wiki.fc2.com

stackoverflow.com import pandas from openpyxl import load_workbookbook = load_workbook('Masterfile.xlsx') writer = pandas.ExcelWriter('Masterfile.xlsx', engine='openpyxl') writer.book = book writer.sheets = dict((ws.title, ws) for ws in bo…

Anaconda

アップデート conda update conda conda update anaconda conda update --all 仮想環境 conda create -n py34 python=3.4 anaconda # -n name

PyQt4 チュートリアル

zetcode.com

はてな記法 TeX 表記(MathJax)

[tex:-\frac{\hbar^2}{2m}\nabla^2\psi+V(x,y,z)\psi =i\hbar\frac{\partial\psi}{\partial t}]

Python

Python3.4 仮想環境 仮想環境の生成: $ pyvenv /path/to/new/virtual/environment 仮想環境 ON: $ source <venv>/bin/activate 仮想環境 OFF: $ deactivatepip をインストール $sudo apt-get install python-pipPython パッケージをインストール(仮想環境で) $pip </venv>…

Raspberry Pi wi-fi ステルスのとき /etc/wpa_supplicant/wpa_supplicant.conf network{} 内に scan_ssid=1 と記入

はてな記法モード

てすと テスト スーパーpre記法(シンタックス・ハイライト)のテスト for i in range(100): print('スーパーpre記法(シンタックス・ハイライト)')

Python 勉強中

# editor ## Atom