雑多な技術系メモ

自分用のメモ。内容は保証しません。よろしくお願いします。

2018-01-01から1年間の記事一覧

【tex】 表に斜線をいれる方法

tex

slashbox.styを用いる。 以下のサイトからダウンロードできる https://ctan.org/tex-archive/macros/latex/contrib/slashbox \usepackage{slashbox} \backslashbox{A}{B} 参考 https://www.biwako.shiga-u.ac.jp/sensei/kumazawa/tex/slashbox.html

【SUMO】現在のPhaseの残り時間の取得

# tlidは信号機のid time = traci.trafficlight.getNextSwitch(tlid) - traci.simulation.getCurrentTime() print(time)

SUMOでスクリーンショットを撮る

# スクリーンショット用↲ ids = traci.gui.getIDList() traci.gui.screenshot(ids[0],"test.pdf")

matplotlibで凡例をグラフ外の右上に出す

サンプルコード 省略 plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0) # 右上に出す plt.subplots_adjust(left = 0.1, right = 0.7) # ここで、図がキャンバス内に収まるように調整する

pythonのElementTree(xmlファイル)で編集して、きれいに(改行をうまくして)保存する方法

サンプルコード from xml.dom import minidom 省略 xmlstr = minidom.parseString(ET.tostring(root)).toprettyxml(indent=" ") with open("xml.xml", "w") as f: f.write(xmlstr) 参考 https://stackoverflow.com/questions/28813876/how-do-i-get-pythons-…

【keras】keras のモデルの保存と読み込み

モデルの保存 # モデルの保存 json_model = model.to_json() with open("model.json", "w") as f json.dump(text, f) # パラメータの保存 model.save_weights("param.hdf5") 保存したモデルの読み込み from keras.models import model_from_json # モデルの…

【python】【xml】すでにあるxmlに要素を追加

サンプルコード import xml.etree.ElementTree as ET tree = ET.ElementTree(file="file.xml") # xmlを読み込む root = tree.getroot() element = ET.Element("vType") # 要素の作成 element.set("A", "a") # 属性の追加 root.insert(0, element) # 作成した…

sumoの信号機のoffsetについてのメモ

まずは、信号機の設定が記述してあるファイル net.xml <tlLogic id="1/2" type="static" programID="0" offset="2">↲ <phase duration="33" state="GGGggrrrrrGGGggrrrrr"/>↲ <phase duration="3" state="yyyggrrrrryyyggrrrrr"/>↲ <phase duration="6" state="rrrGGrrrrrrrrGGrrrrr"/>↲ <phase duration="3" state="rrryyrrrrrrrryyrrrrr"/>↲ </phase></phase></phase></phase></tllogic>

texで目次をいれる

tex

サンプルコード \begin{document} \tableofcontents % 目次の表示 \section{}

texでメモするときに使えるライブラリTodonotesのダウンロード

tex

以下のサイトからzip のダウンロード https://ctan.org/pkg/todonotes ダウンロードしたzipを解凍して、以下のコマンドを実行 latex todonotes.ins 生成されてtodonotes.styを読み込んで使う

oandpyのインストール

oandpyをpipでインストールする方法 pip install git+https://github.com/oanda/oandapy.git

chrome extensionで現在タブで開いているページのタイトルとurlを取得

以下のコードを同じフォルダにいれる。 基本的に、最初のサンプルプログラムであるhello サンプルを変更しただけ。 manifest.json { "name": "Hello Extensions", "description" : "Base Level Extension", "version": "1.0", "browser_action": { "default_…

【Ubuntu】shift-jisからutf-8に変換

nkf のインストール sudo apt-get install nkf 文字コードのチェック nkf -g data.csv utf-8に変換 nkf -w --overwrite data.csv

vimに和英辞書の追加

vim

基本的に以下のサイト通りにやればできる http://d.hatena.ne.jp/akishin999/20131024/1382569289 http://cohama.hateblo.jp/entry/2013/08/11/020849

【tex】texの数式関連メモ

tex

記号関連 ドイツ文字など 括弧関連 なぜなら 等号関連 集合関連 参考 max 比例 定義 参考 記号関連 入力 出力 メモ \widetilde{a} $\widetilde{a}$ \bar{a} $\bar{a}$ \tilde{a} $\tilde{a}$ \because $\because$ なぜなら ドイツ文字など https://phasetr.c…

【確立】確立関連のメモ

条件付き確率について 以下の参考サイトがものすごくわかりやすい。 https://mathtrain.jp/jyokentsuki 上記のサイトのベン図を元に $$ P(B \mid A) = \frac{P(A \cap B)}{P(A)} $$ を導出する。 参考サイトからわかるように、 $$ P(A) = \frac{|A|}{|n|} \\…

error: xerces-lib not found.

sudo apt-get install libxerces-c-dev

error: [Errno 2] No such file or directory: 'libtoolize'

sudo apt-get install libtool

error: [Errno 2] No such file or directory: 'aclocal'

sudo apt-get install autotools-dev

zshでのコマンド入力時の注意

以下のようなコマンドをzshで実行すると pip install gym[atari] 以下のようなエラーが発生する zsh: no matches found: gym[atari] かっこ([])などはエラーで引っかかる エスケープする必要がある なので、以下のようにする pip install gym\[atari\]

【Windows】pycharmのterminalをbash(Windows on Bash)に

File -> setting -> Tools -> terminal Shell pathをcmd.exe からbash.exeにする

gitの操作関連のメモ(完全に自分用)

gitの操作方法のメモ remote branchをローカルでチェックアウトする git checkout -b local_branch_name origin/remote_branch_name 参考 https://qiita.com/YusukeSuzuki@github/items/3bd5752783fd2c2f8805

【Libreoffice】Impressでデフォルトの図形の設定

以下の手順で、図形の設定を行う画面がでる 書式 スタイル 影月オブジェクト

Windows上にSUMOをインストール

http://www.dlr.de/ts/en/desktopdefault.aspx/tabid-9883/16931_read-41000/ 上記のサイトのDownloadsのSUMO * for Windowsをクリックし、msiファイルをダウンロード 後はダウンロードしたmsiファイルを実行すれば良い

Windowsマシンで、Ubuntuのisoファイルをusbに焼く方法で一番参考になったサイト

https://www.archlinux.site/2018/03/windows-10ubuntuusb.html 上記のサイトが通りに行うのが一番容易だった

【python】範囲を指定して、ランダムの整数を生成する

import random random.randint(a,b) # a以上b未満のランダムな整数を返す

数学関連のメモ

一様収束 D上で定義された関数列 ${f_n}$ に対し $f_n \rightarrow f$が一様収束する必要十分条件は $$ | f_n(x) - f(x) | \rightarrow 0 $$ 例 次のような関数列を考える $$ f_n (x) = \frac{x}{n}, 0 \leq x \leq -6 $$ の極限関数fはf(x) = 0 nを固定して…

自分用のubuntuの初期設定

chrome インストール skype インストール ソフトウェアマーケットで検索すれば出てくる terminator のインストール sudo apt-get install terminator gitのインストール sudo apt-get install git git config --global core.editor vim ctrl capslock入れ替…

ubuntu上にandroid-stuidoインストールするときに参考になったサイト

参考サイト https://www.hiroom2.com/2017/09/15/ubuntu-1604-android-studio-2-3-ja/

【Swift】Ubuntu Swiftインストール

参考文献 基本的に参考文献通りにインストールすれば良い https://www.poly-rhythm.com/install-swift-to-ubuntu/ 手順(完全に自分用) sudo apt-get install clang libicu-dev https://swift.org/download/#releases からダウンロード ダウンロードしたファ…