ipmitool:
ipmitool -I lanplus -H 192.168.1.123 -U admin -P password raw 0x06 0x01
ipmi-raw:
ipmi-raw -D LAN_2_0 -h 192.168.1.123 -u admin -p password 0x00 0x06 0x01
icmd:
icmd -J 3 -N 192.168.1.123 -U admin -P password 00 20 18 01
個人在學習Linux過程當中的個人筆記,提供個人及有需要的人查閱,若有錯誤歡迎提供指正,謝謝。 This Blog recorded notes about my learning Linux and provides myself and others reference. If there are any incorrect information, welcome to leave a message to correct me, Thanks.
2018年2月8日 星期四
redfishtool on ubuntu
1. apt-get update
2. apt-get install python python3 python-pip
3. make a file /etc/pip.conf if you need proxy setting for pip
[list]
format=columns
[global]
trusted-host = pypi.python.org
proxy = http://127.0.0.1:3128
4. pip install virtualenvwrapper
5. login with normal user (not root)
6. add one line in tail of .bashrc
source $(which virtualenvwrapper.sh)
7. re-login
8. create a virtualenv of python3
mkvirtualenv -p $(which python3) redfish
9. pip install redfishtool
redfishtool commands:
redfishtool -u admin -p password -r 192.168.1.123 -S Always System
redfishtool -u admin -p password -r 192.168.1.123 -S Always System -a
redfishtool -u admin -p password -r 192.168.1.123 -S Always raw /redfish/v1/xxxx/xxxx
======
For Ubuntu 17.10, before step5
Need to add ~/.local/bin to PATH, edit ~/.bashrc
# set PATH ~/.local/bin
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
2. apt-get install python python3 python-pip
3. make a file /etc/pip.conf if you need proxy setting for pip
[list]
format=columns
[global]
trusted-host = pypi.python.org
proxy = http://127.0.0.1:3128
4. pip install virtualenvwrapper
5. login with normal user (not root)
6. add one line in tail of .bashrc
source $(which virtualenvwrapper.sh)
7. re-login
8. create a virtualenv of python3
mkvirtualenv -p $(which python3) redfish
9. pip install redfishtool
redfishtool commands:
redfishtool -u admin -p password -r 192.168.1.123 -S Always System
redfishtool -u admin -p password -r 192.168.1.123 -S Always System -a
redfishtool -u admin -p password -r 192.168.1.123 -S Always raw /redfish/v1/xxxx/xxxx
======
For Ubuntu 17.10, before step5
Need to add ~/.local/bin to PATH, edit ~/.bashrc
# set PATH ~/.local/bin
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
2018年2月7日 星期三
Install freeipmi on ubuntu
1. Download source from https://www.gnu.org/software/freeipmi/
2. install libgcrypt-dev
# sudo apt-get install libgcrypt-dev
3. compiler
# tar zxvf freeipmi-1.6.1.tar.gz
# cd freeipmi-1.6.1
# ./configure
# make
# sudo make install
4. make the change permanent you can add
https://unix.stackexchange.com/questions/67781/use-shared-libraries-in-usr-local-lib
2. install libgcrypt-dev
# sudo apt-get install libgcrypt-dev
3. compiler
# tar zxvf freeipmi-1.6.1.tar.gz
# cd freeipmi-1.6.1
# ./configure
# make
# sudo make install
4. make the change permanent you can add
/usr/local/lib to /etc/ld.so.conf (or something it includes) and run ldconfig as root.https://unix.stackexchange.com/questions/67781/use-shared-libraries-in-usr-local-lib
2018年1月24日 星期三
docker named volume path
Located at host's /var/lib/docker/volumes/
https://stackoverflow.com/questions/36312699/chown-docker-volumes-on-host-possibly-through-docker-compose/36321403#36321403
https://github.com/CWSpear/local-persist
https://stackoverflow.com/questions/36312699/chown-docker-volumes-on-host-possibly-through-docker-compose/36321403#36321403
https://github.com/CWSpear/local-persist
Python project scaffold
http://docs.python-guide.org/en/latest/writing/structure/
https://www.kennethreitz.org/essays/repository-structure-and-python
https://github.com/pypa/sampleproject
https://github.com/sroberts/python-starter
找到這個generator,感覺更方便,處理方式也比較先進。
https://pypi.python.org/pypi/PyScaffold
pip install pyscaffold
putup my_project
如果是Django project可加--django參數,不過應該只是單純的幫你多下一次
django-admin.py startproject my_project而已
如果想要把apps放到不是project的root,而是像src的資料夾
在startapp之前要先把資料夾建好
mkdir ./src/newapp
然後才startapp
python manage.py startapp newapp ./src/newapp
之後要在project的setting.py多加這兩行
import sys
sys.path.insert(0, os.path.join(BASE_DIR, "src"))
才能在runserver時找到newapp
參考這個的
https://www.kennethreitz.org/essays/repository-structure-and-python
https://github.com/pypa/sampleproject
https://github.com/sroberts/python-starter
找到這個generator,感覺更方便,處理方式也比較先進。
https://pypi.python.org/pypi/PyScaffold
pip install pyscaffold
putup my_project
如果是Django project可加--django參數,不過應該只是單純的幫你多下一次
django-admin.py startproject my_project而已
如果想要把apps放到不是project的root,而是像src的資料夾
在startapp之前要先把資料夾建好
mkdir ./src/newapp
然後才startapp
python manage.py startapp newapp ./src/newapp
之後要在project的setting.py多加這兩行
import sys
sys.path.insert(0, os.path.join(BASE_DIR, "src"))
才能在runserver時找到newapp
參考這個的
2018年1月16日 星期二
用Bitbucket存放Source code (如果ssh port22被擋)
SSH的 git@bitbucket.org:farwill/testlink_converter.git
改成HTTPS的 https://farwill@bitbucket.org/farwill/testlink_converter.git
所以是
git remote add origin https://farwill@bitbucket.org/farwill/testlink_converter.git
git push -u origin master
2017年12月20日 星期三
Python的Unicode HOWTO
https://docs.python.org/3/howto/unicode.html
最早的ASCII碼(Code),只有0~127(7bits),無法包含更多特殊字。
1980年代的個人電腦幾乎都是8bit,所以可以處理ASCII且還多出128~255可以使用,但不同機器有不同的Code。
Unicode一開始用16bits來取代原來的8bits,有2^16 (65536)個值可使用,目標是可包含所有的語言,但其實還是不夠。後來擴展到 0 through 1,114,111 (
一個字元(Character),Unicode定義了一個字元的Code point,就是這個字元的值。表示法如U+12CA就表示值是0x12ca的字元。
Encoding(編碼)是指從字串轉為位元組序列的規則,UTF-8就是一種最普遍的編碼方式,UTF (Unicode Transformation Format),8是指8-bits的數字被使用來編碼。規則是這樣:
若想保持Python的原始碼是ASCII-only,可用Escape字符 /u或/U或/N字元名來編寫
Python 3.2有100種不同的encoding。
單個字元的轉換,可用chr(int)輸出Unicode,用ord(str)輸出值(code point)
字串與位元組串的操作是
最早的ASCII碼(Code),只有0~127(7bits),無法包含更多特殊字。
1980年代的個人電腦幾乎都是8bit,所以可以處理ASCII且還多出128~255可以使用,但不同機器有不同的Code。
Unicode一開始用16bits來取代原來的8bits,有2^16 (65536)個值可使用,目標是可包含所有的語言,但其實還是不夠。後來擴展到 0 through 1,114,111 (
0x10FFFF in base 16).一個字元(Character),Unicode定義了一個字元的Code point,就是這個字元的值。表示法如U+12CA就表示值是0x12ca的字元。
Encoding(編碼)是指從字串轉為位元組序列的規則,UTF-8就是一種最普遍的編碼方式,UTF (Unicode Transformation Format),8是指8-bits的數字被使用來編碼。規則是這樣:
- If the code point is < 128, it’s represented by the corresponding byte value.
- If the code point is >= 128, it’s turned into a sequence of two, three, or four bytes, where each byte of the sequence is between 128 and 255.
# -*- coding: -*-
Python支援以Unicode為名的變數若想保持Python的原始碼是ASCII-only,可用Escape字符 /u或/U或/N字元名來編寫
>>> "\N{GREEK CAPITAL LETTER DELTA}" # Using the character name '\u0394' >>> "\u0394" # Using a 16-bit hex value '\u0394' >>> "\U00000394" # Using a 32-bit hex value '\u0394'另外,可用bytes的method "decode()"來輸出Unicode,另外帶encoding參數和error處理方式(請看最上方連結)
Python 3.2有100種不同的encoding。
單個字元的轉換,可用chr(int)輸出Unicode,用ord(str)輸出值(code point)
字串與位元組串的操作是
bytes.decode() 和 str.encode()
The most important tip is:
Software should only work with Unicode strings internally, decoding the input data as soon as possible and encoding the output only at the end.
訂閱:
文章 (Atom)