GPSの情報をTerminalで取得する
作成しているアプリケーションでGPSを使うようなのでメモっておく。
うちの研究室ではこれを買った。
http://www.gpsdgps.com/product/pr_br-355s4.htm
マニュアル通りやろうとしてCD-ROM入れようとしたけどWindowsのみだったので断念。
どうやらTerminalでGPSの情報は取得できるらしいのでメモ。
実行方法
$ su - Password: su: Authentication failure $ sudo su # stty -F /dev/ttyUSB0 ispeed 4800 && cat < /dev/ttyUSB0
su -だとエラー出たけどなんでだろう。。今度調べてみよう。
実行結果
UbuntuのTerminalの紫色の色コード
UbuntuのTerminalの紫色いいな〜と思い、MacのTerminalやその他色々なところで設定したいと思い始めた。
そこで「Ubuntu 色 コード」とかでググってもなかなか出てこないので画像から色コードを抽出してくれるサイトを利用して調べてみた。利用したのは以下のサイト。
iromiru (イロミル) - 画像からカラーコード抽出便利サービス
適当に拾ったこの画像で調べてみたところどうやら #300a24 ということが発覚。
因みに上のバーの灰色のところは、 #484742 でした。
Ubuntu14.04にndnSIMをダウンロード
公式サイトに従いインストール
Getting Started — ndnSIM documentation
ここに沿って行う。
~$ sudo aptitude install libboost-all-dev ~$ sudo apt-get install python-dev python-pygraphviz python-kiwi ~$ sudo apt-get install python-pygoocanvas python-gnome2 ~$ sudo apt-get install python-gnomedesktop python-rsvg ipython ~$ mkdir ndnSIM ~$ cd ndnSIM ~/ndnSIM$ git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3 ~/ndnSIM$ git clone git://github.com/cawka/pybindgen.git pybindgen ~/ndnSIM$ git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM ~/ndnSIM/ns-3$ cd ns-3/ ~/ndnSIM/ns-3$ ./waf configure --enable-examples
赤いのが出ても気にしない。
~/ndnSIM/ns-3$ ./waf
ちょっと時間が掛かる。
プログラムを実行
Examples — ndnSIM documentation ~/ndnSIM/ns-3に「ndn-simple.cc」という名前でソースを置いておく。
~/ndnSIM/ns-3$ ./waf --run=ndn-simple --vis
図が出てくればおk。
Ubuntu14.04でEmacsキーバインドを使うために、CapsLockにCtrlを割り当てる
DeleteはCapsLock+Hで行うものである
現在研究室ではUbuntu+JISキーを使っているけど、
ということでかなりストレスなので、CapsLockキーを追加のCtrlキーとして使う。
$ dconf reset /org/gnome/settings-daemon/plugins/keyboard/active $ dconf write /org/gnome/desktop/input-sources/xkb-options "['ctrl:nocaps']"
快適快適!!
参考サイト
UbuntuTips/Desktop/HowToSetCapsLockAsCtrl - Ubuntu Japanese Wiki
【ndnSIM】scenarioで「./waf configure」を実行してもエラーが返ってくるのでndnSIMを再インストールしてみた
パッケージがインストールされてることを確認
以下を参考にした indicationの日記 | スラド
$ sudo aptitude install libboost-all-dev [sudo] password for ccn-disaster: No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used. $ sudo aptitude install libboost1.48-all-dev Couldn't find any package whose name or description matched "libboost1.48-all-dev" Couldn't find any package whose name or description matched "libboost1.48-all-dev" No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used. $ aptitude search libboost-all-dec $ aptitude search libboost-all-dev i libboost-all-dev - Boost C++ Libraries development files (ALL) p libboost-all-dev:i386 - Boost C++ Libraries development files (ALL) $ aptitude show libboost-all-dev Package: libboost-all-dev State: installed Automatically installed: no Version: 1.54.0.1ubuntu1 Priority: optional Section: universe/libdevel Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> Architecture: amd64 Uncompressed Size: 26.6 k Depends: libboost-dev, libboost-tools-dev, libboost-atomic-dev, libboost-chrono-dev, libboost-context-dev, libboost-coroutine-dev, libboost-date-time-dev, libboost-exception-dev, libboost-filesystem-dev, libboost-graph-dev, libboost-graph-parallel-dev, libboost-iostreams-dev, libboost-locale-dev, libboost-log-dev, libboost-math-dev, libboost-mpi-dev, libboost-mpi-python-dev, libboost-program-options-dev, libboost-python-dev, libboost-random-dev, libboost-regex-dev, libboost-serialization-dev, libboost-signals-dev, libboost-system-dev, libboost-test-dev, libboost-thread-dev, libboost-timer-dev, libboost-wave-dev Conflicts: libboost-all-dev Description: Boost C++ Libraries development files (ALL) (default version) The Boost web site provides free, peer-reviewed, portable C++ source libraries. The emphasis is on libraries which work well with the C++ Standard Library. One goal is to establish "existing practice" and provide reference implementations so that the Boost libraries are suitable for eventual standardization. Some of the libraries have already been proposed for inclusion in the C++ Standards Committee's upcoming C++ Standard Library Technical Report. This metapackage provides the complete Boost development environment, including all separately-packaged libraries. This package is a dependency package, which depends on Debian's default Boost version (currently 1.54). Homepage: http://www.boost.org/ nnn||<~$ sudo aptitude install libboost-all-dev [sudo] password for ccn-disaster: No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used. $ sudo aptitude install libboost1.48-all-dev Couldn't find any package whose name or description matched "libboost1.48-all-dev" Couldn't find any package whose name or description matched "libboost1.48-all-dev" No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used. $ aptitude search libboost-all-dec $ aptitude search libboost-all-dev i libboost-all-dev - Boost C++ Libraries development files (ALL) p libboost-all-dev:i386 - Boost C++ Libraries development files (ALL) ~$ aptitude show libboost-all-dev Package: libboost-all-dev State: installed Automatically installed: no Version: 1.54.0.1ubuntu1 Priority: optional Section: universe/libdevel Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> Architecture: amd64 Uncompressed Size: 26.6 k Depends: libboost-dev, libboost-tools-dev, libboost-atomic-dev, libboost-chrono-dev, libboost-context-dev, libboost-coroutine-dev, libboost-date-time-dev, libboost-exception-dev, libboost-filesystem-dev, libboost-graph-dev, libboost-graph-parallel-dev, libboost-iostreams-dev, libboost-locale-dev, libboost-log-dev, libboost-math-dev, libboost-mpi-dev, libboost-mpi-python-dev, libboost-program-options-dev, libboost-python-dev, libboost-random-dev, libboost-regex-dev, libboost-serialization-dev, libboost-signals-dev, libboost-system-dev, libboost-test-dev, libboost-thread-dev, libboost-timer-dev, libboost-wave-dev Conflicts: libboost-all-dev Description: Boost C++ Libraries development files (ALL) (default version) The Boost web site provides free, peer-reviewed, portable C++ source libraries. The emphasis is on libraries which work well with the C++ Standard Library. One goal is to establish "existing practice" and provide reference implementations so that the Boost libraries are suitable for eventual standardization. Some of the libraries have already been proposed for inclusion in the C++ Standards Committee's upcoming C++ Standard Library Technical Report. This metapackage provides the complete Boost development environment, including all separately-packaged libraries. This package is a dependency package, which depends on Debian's default Boost version (currently 1.54). Homepage: http://www.boost.org/
ndnSim公式のインストール方法を試す
Getting Started — ndnSIM documentation
このサイトの「Requirements > 3 > For Ubuntu」の方法を試してみる。
$ sudo apt-get install python-dev python-pygraphviz python-kiwi Reading package lists... Done Building dependency tree Reading state information... Done python-dev is already the newest version. python-kiwi is already the newest version. python-pygraphviz is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. $ sudo apt-get install python-pygoocanvas python-gnome2 Reading package lists... Done Building dependency tree Reading state information... Done python-gnome2 is already the newest version. python-pygoocanvas is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. $ sudo apt-get install python-gnomedesktop python-rsvg ipython Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package python-gnomedesktop
最後だけ発見出来ないと…。
他のサイトでUbuntu14.04にインストールする方法が書いてあるので試してみる
ここによると3つ目のインストールするものだけちょっと違っている。
実行。
$ sudo apt-get install python-rsvg ipython python-pygccxml Reading package lists... Done Building dependency tree Reading state information... Done python-pygccxml is already the newest version. The following extra packages will be installed: python-decorator python-simplegeneric Suggested packages: ipython-doc ipython-notebook ipython-qtconsole python-matplotlib python-numpy python-zmq The following NEW packages will be installed: ipython python-decorator python-rsvg python-simplegeneric 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 633 kB of archives. After this operation, 3,547 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://jp.archive.ubuntu.com/ubuntu/ trusty/main python-decorator all 3.4.0-2build1 [19.2 kB] Get:2 http://jp.archive.ubuntu.com/ubuntu/ trusty/main python-simplegeneric all 0.8.1-1 [11.5 kB] Get:3 http://jp.archive.ubuntu.com/ubuntu/ trusty/universe ipython all 1.2.1-2 [588 kB] Get:4 http://jp.archive.ubuntu.com/ubuntu/ trusty/main python-rsvg amd64 2.32.0+dfsg-3 [13.9 kB] Fetched 633 kB in 0s (1,043 kB/s) Selecting previously unselected package python-decorator. (Reading database ... 360315 files and directories currently installed.) Preparing to unpack .../python-decorator_3.4.0-2build1_all.deb ... Unpacking python-decorator (3.4.0-2build1) ... Selecting previously unselected package python-simplegeneric. Preparing to unpack .../python-simplegeneric_0.8.1-1_all.deb ... Unpacking python-simplegeneric (0.8.1-1) ... Selecting previously unselected package ipython. Preparing to unpack .../ipython_1.2.1-2_all.deb ... Unpacking ipython (1.2.1-2) ... Selecting previously unselected package python-rsvg. Preparing to unpack .../python-rsvg_2.32.0+dfsg-3_amd64.deb ... Unpacking python-rsvg (2.32.0+dfsg-3) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for hicolor-icon-theme (0.13-1) ... Processing triggers for gnome-menus (3.10.1-0ubuntu2) ... Processing triggers for desktop-file-utils (0.22-1ubuntu1) ... Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Processing triggers for mime-support (3.54ubuntu1) ... Setting up python-decorator (3.4.0-2build1) ... Setting up python-simplegeneric (0.8.1-1) ... Setting up ipython (1.2.1-2) ... Setting up python-rsvg (2.32.0+dfsg-3) ...
大丈夫なのかな?続ける。
$ mkdir ndnSIM $ cd ndnSIM $ git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3 Cloning into 'ns-3'... remote: Counting objects: 113588, done. remote: Compressing objects: 100% (30040/30040), done. remote: Total 113588 (delta 82727), reused 113588 (delta 82727) Receiving objects: 100% (113588/113588), 69.84 MiB | 4.92 MiB/s, done. Resolving deltas: 100% (82727/82727), done. Checking connectivity... done. $ git clone git://github.com/cawka/pybindgen.git pybindgen Cloning into 'pybindgen'... remote: Counting objects: 5710, done. remote: Total 5710 (delta 0), reused 0 (delta 0) Receiving objects: 100% (5710/5710), 11.18 MiB | 3.67 MiB/s, done. Resolving deltas: 100% (3759/3759), done. Checking connectivity... done. $ git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM Cloning into 'ns-3/src/ndnSIM'... remote: Counting objects: 7801, done. remote: Total 7801 (delta 0), reused 0 (delta 0) Receiving objects: 100% (7801/7801), 5.77 MiB | 1.39 MiB/s, done. Resolving deltas: 100% (3656/3656), done. Checking connectivity... done. $ cd ns-3/ $ cd ns-3/ $ ./waf configure --enable-examples ... ~/ndnSIM/ns-3$ ./waf ... ~/ndnSIM/ns-3$ ./waf --run=ndn-simple --vis Waf: Entering directory `/home/ccn-disaster/ndnSIM/ns-3/build' Waf: Leaving directory `/home/ccn-disaster/ndnSIM/ns-3/build' 'build' finished successfully (1.109s) Could not load icon applets-screenshooter due to missing gnomedesktop Python module Could not load icon gnome-terminal due to missing gnomedesktop Python module scanning topology: [0, 3) nodes... $
最後に図がでるか試してみたけど、ちゃんと図は出る。
公式の方法で続きを行う
公式に戻って「Simulating using ndnSIM」の「# Build and install NS-3 and ndnSIM」から実行。
~/ndnSIM/ns-3$ ./waf configure -d optimized ... ~/ndnSIM/ns-3$ ./waf ... ~/ndnSIM/ns-3$ sudo ./waf install ~/ndnSIM/ns-3$ cd .. ~/ndnSIM$ ~/ndnSIM$ git clone git://github.com/cawka/ndnSIM-scenario-template.git scenario Cloning into 'scenario'... remote: Counting objects: 40, done. remote: Total 40 (delta 0), reused 0 (delta 0) Receiving objects: 100% (40/40), 97.41 KiB | 61.00 KiB/s, done. Resolving deltas: 100% (11/11), done. Checking connectivity... done. ~/ndnSIM$ cd scenario ~/ndnSIM/scenario$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ~/ndnSIM/scenario$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH ~/ndnSIM/scenario$ ./waf configure Setting top to : /home/ccn-disaster/ndnSIM/scenario Setting out to : /home/ccn-disaster/ndnSIM/scenario/build Checking for 'g++' (c++ compiler) : /usr/bin/g++ Checking boost includes : 1_54 Checking boost libs : lib iostreams not found in /usr/local/lib (complete log in /home/ccn-disaster/ndnSIM/scenario/build/config.log)
またダメだった。
こっちのを試す。
~/ndnSIM/scenario$ cd ../ ~/ndnSIM$ sudo apt-get install g++ Reading package lists... Done Building dependency tree Reading state information... Done g++ is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~/ndnSIM$ sudo apt-get install gccxml Reading package lists... Done Building dependency tree Reading state information... Done gccxml is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~/ndnSIM$ sudo apt-get install libboost-all-dev Reading package lists... Done Building dependency tree Reading state information... Done libboost-all-dev is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~/ndnSIM$ sudo apt-get install libsqlite3-dev Reading package lists... Done Building dependency tree Reading state information... Done libsqlite3-dev is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. cd pybindgen ./waf configure ./waf sudo ./waf install cd ../ cd ns-3 ./waf configure -d optimized --enable-examples ./waf sudo ./waf install ~/ndnSIM/ns-3$ cd ../scenario/ ~/ndnSIM/scenario$ ./waf configure Setting top to : /home/ccn-disaster/ndnSIM/scenario Setting out to : /home/ccn-disaster/ndnSIM/scenario/build Checking for 'g++' (c++ compiler) : /usr/bin/g++ Checking boost includes : 1_54 Checking boost libs : lib iostreams not found in /usr/local/lib (complete log in /home/ccn-disaster/ndnSIM/scenario/build/config.log) ~/ndnSIM/scenario$ ./waf --run=ndn-simple --vis The project was not configured: run "waf configure" first!
sites.google.com うーん。。。iostreamsが見つからないと。。。
公式のFAQに書いてあることを実行
FAQに書いてあることしてみる。 上から順番に行う。
~/ndnSIM/bzip2-1.0.6$ ./b2 --prefix=$BOOSTDIR cxxflags=-I$BOOSTDIR/include linkflags=-L$BOOSTDIR/lib install bash: ./b2: No such file or directory ~/ndnSIM/bzip2-1.0.6$ cd ../scenario/ ~/ndnSIM/scenario$ ./waf configure
./b2はエラーが返ってきたので、この段階で./waf configureを実行してみる。
~/ndnSIM/bzip2-1.0.6$ cd ../scenario/ ~/ndnSIM/scenario$ ./waf configure ^[[3~Setting top to : /home/ccn-disaster/ndnSIM/scenario Setting out to : /home/ccn-disaster/ndnSIM/scenario/build Checking for 'g++' (c++ compiler) : /usr/bin/g++ Checking boost includes : 1_54 Checking boost libs : ok Checking for boost linkage : ok ...
なんか知らんが出来てる!! ndnSim/ns-3/exampleの中から適当に.ccファイルをコピーしてきてscenario直下にペースト。
~/ndnSIM/scenario$ ./waf --run=tcp-star-server --vis Waf: Entering directory `/home/ccn-disaster/ndnSIM/scenario/build' [1/2] cxx: scenarios/tcp-star-server.cc -> build/scenarios/tcp-star-server.cc.2.o [2/2] cxxprogram: build/scenarios/tcp-star-server.cc.2.o -> build/tcp-star-server Waf: Leaving directory `/home/ccn-disaster/ndnSIM/scenario/build' 'build' finished successfully (1.686s) Could not load icon applets-screenshooter due to missing gnomedesktop Python module Could not load icon gnome-terminal due to missing gnomedesktop Python module scanning topology: [0, 9) nodes...
出来たー! pcapファイルがめっちゃ作られてるけどそれはccファイルに出力するように書かれてるのかな?
バイトあるし台風来るしお腹減ったし帰りたいので今日はここまで。
Ubuntu & Mac - Terminalのプロンプトを設定
Ubuntu
~/.bashrcのPS1を書き換える。
if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\[\e[1;33m\]\w\$\[\e[00m\] ' fi
こんな感じ。
Mac
~/.bash_profile に以下を書くと
PS1='\e[0;33m\w:\u $ \e[0m'
こんな感じ。 背景紫に、文字黄色と白いいなぁ。
P.S.
スクショのコマンド知らなかったし、ここみたら便利そうなコマンドいっぱいあったから使ってこ。
Ubuntu 16.04 LTSで使えるキーボードショートカット一覧 - 旧ID:itiriのブログ
Rails - WEBrickでポートを指定する方法3つまとめ
1:3000以外のポートを指定
$ rails s -p3001
http://0.0.0.0:3001にアクセス。
参考
2:ポート80番に指定
$ sudo rails server -p 80
http://0.0.0.0/にアクセス。
参考
http://yoshifumisato.jeez.jp/wordpress/post/ruby/935
3:デフォルトポートを変更
rails sを実行した際に3000以外のポートで起動したい場合、config/boot.rbなどに以下を書く。
require 'rails/commands/server' module Rails class Server def default_options super.merge({ :Port => 4000 }) end end end