echo '{"one":1,"two":2}' | python -mjson.tool
programming
- json beautify 2016.03.30
- set -e 2015.03.17
- vim screen config ( for python - include bundle ) 2014.12.29 1
- virtualenv 2014.12.29
- pip 2014.12.29
- gdb core image save 2014.11.07
- java 설치 2010.11.09
- Find the speed of your Ethernet card in Linux & Full/Half Duplex 2009.11.09
- vim 컴파일시 configure 옵션 & xterm clipboard 2009.06.25
- vim 설치된 곳은? ( :echo $VIMRUNTIME ) 2009.06.04
json beautify
set -e
set -e
bash script 실행중 에러 발생시 즉시 종료( 자세한 내용은 manpage 참조 )
man bash
...
SHELL BUILTIN COMMANDS
set [--abefhkmnptuvxBCEHPT] [-o option-name] [arg ...]
set [+abefhkmnptuvxBCEHPT] [+o option-name] [arg ...]
...
-e Exit immediately if a pipeline (which may consist of a single simple command), a list, or a compound command (see SHELL GRAMMAR above), exits with a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a while or until
keyword, part of the test following the if or elif reserved words, part of any command executed in a && or || list except the command following
the final && or ||, any command in a pipeline but the last, or if the command's return value is being inverted with !. If a compound command
other than a subshell returns a non-zero status because a command failed while -e was being ignored, the shell does not exit. A trap on ERR,
if set, is executed before the shell exits. This option applies to the shell environment and each subshell environment separately (see COMMAND
EXECUTION ENVIRONMENT above), and may cause subshells to exit before executing all the commands in the subshell.
If a compound command or shell function executes in a context where -e is being ignored, none of the commands executed within the compound com‐
mand or function body will be affected by the -e setting, even if -e is set and a command returns a failure status. If a compound command or
shell function sets -e while executing in a context where -e is ignored, that setting will not have any effect until the compound command or
the command containing the function call completes.
vim screen config ( for python - include bundle )
virtualenv
ref: http://pythoninreal.blogspot.kr/2013/12/virtualenv.html
ref: http://yong27.biohackers.net/373
설치:
sudo pip install virtualenv
프로젝트 생성:
virtualenv 프로젝트명
ex) virtualenv ar_project
이때, ar_project 폴더 생성후 python 기본 libs 가 복사됩니다.
해당 가상환경으로 들어가기:
. ar_project/bin/activate
프로젝트 패키지 목록:
pip freeze > requirements.txt
패키지 목록 설치:
pip install -r requirements.txt
pip
설치
$ apt-get install python-setuptools
$ easy_install -U pip
기존에는 아래와 같이 간단히 'apt-get install python-pip' 를 사용했었는데, 에러 발생시 우분투에서 빨리 패치를 해주는것 같지 않다. 그래서 귀찮아도 위처럼 설치 하기로 결정~
ref: http://stackoverflow.com/questions/27341064/how-do-i-fix-importerror-cannot-import-name-incompleteread/27341847#27341847
or
$ apt-get install python-pip
gdb core image save
(gdb) help generate-core-file
Save a core file with the current state of the debugged process.
Argument is optional filename. Default filename is 'core.<process_id>'.
(gdb) generate-core-file
kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3
38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8
43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
63) SIGRTMAX-1 64) SIGRTMAX
kill -STOP pid
kill -19 pid
gdb program_name `pidof program_name`
kill -CONT pid
kill -18 pid
kill -STOP `pidof RFTS`
gdb RFTS `pidof RFTS`
$ generate-core-file
kill -CONT `pidof RFTS`
java 설치
ps.http://blog.naver.com/theparanbi?Redirect=Log&logNo=80115538857
1. java se 설치
JAVA_HOME 설정 C:\Program Files\Java\jdk6
JRE_HOME 설정 %JAVA_HOME%\jre
PATH 에 bin 추가
CLASSPATH 에 tools.jar 추가
2. eclipse .. java EE 버전으루..
3. android sdk 설치 PATH 에 tools 추가
4. android ADT 추가 ( in eclipse ) window >> Preference >> android 에 SDK location 지정
5. 그외 셋팅및 추가 tools download ( in eclipse )
Find the speed of your Ethernet card in Linux & Full/Half Duplex
Find the speed of your Ethernet card in Linux
# dmesg |grep eth0
divert: allocating divert_blk for eth0
eth0: RealTek RTL8139 at 0xd800, 00:80:48:34:c2:84, IRQ 9
eth0: Identified 8139 chip type 'RTL-8100B/8139D'
divert: freeing divert_blk for eth0
divert: allocating divert_blk for eth0
eth0: RealTek RTL8139 at 0xd800, 00:90:44:34:a5:33, IRQ 9
eth0: Identified 8139 chip type 'RTL-8100B/8139D'
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
eth0: no IPv6 routers present
...
# mii-tool -v eth0
eth0: negotiated 100baseTx-FD, link ok
product info: vendor 00:00:00, model 0 rev 0
basic mode: autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD
10baseT-HD
...
- 100 Mbps Speed (Full duplex or half duplex ) or
- 10 Mbps speed (Full duplex or half duplex).
# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: p
Current message level: 0x00000007 (7)
Link detected: yes
Here full duplex, half duplex and auto-negotiation have the following meanings.vim 컴파일시 configure 옵션 & xterm clipboard
or
./configure --enable-cscope --enable-multibyte --with-features=big
- using xterm clipboard
make distclean <== 필요시
vim 에서
"+y
로 복사 가능
ps. 플러그인중 python 사용하는게 있을경우.
./configure --enable-cscope --enable-multibyte --with-features=big --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.5/config
파이썬 관련 dev 파일 필요 (header & library )