Encryption은

openssl aes-256-cbc -in input.txt -out output.enc



Decryption은

openssl aes-256-cbc -d -in output.enc -out input.txt

 

 

'리눅스 > 스크립트/유틸' 카테고리의 다른 글

[screen] detached된 세션 죽이기  (0) 2014.02.17
[Makefile] 다른 makefile 포함  (0) 2013.12.30
GDB  (0) 2013.09.24
[Makefile] overriding target 관련 warning 메세지  (0) 2013.09.02
[byobu] vertical line 없애기  (0) 2013.09.01
Posted by code cat

GDB

원래는 GDB 서버랑 클라이언트로 나누어서 보통 보드에다가 서버 돌리고, 호스트에서 접속해서 제어하는 방식을 쓰는데 뭐 접속이 안되서 그냥 클라이언트로 돌렸다. (당연히 해당보드에 맞게 컴파일해야 한다.)

 

gdb는 간단하게 다음과 같이,

gdb ./program_name arg1, ...

으로 실행하면 된다.

 

break 방법으로

(gdb) b main                    //함수로 break

(gdb) b crc.c:32               //소스파일 내 라인으로 break

 

break 정보를 볼라면,

info break

 

하면 되고, 다음의 명령어로 비활성/활성/삭제가 가능하다. (#은 break 에 해당하는 넘버)

disable break #

enable break #

delete break #

 

레지스터 내용을 볼라면,

info reg

 

특정 변수 값을 볼라면,

print var_name (변수 값 출력)

 

현재까지 호출된 fuction 을 backtrace할라면,(괄호는 간단한 명령어)

backtrace(bt)

 

스레드 관련 명령어는 다음과 같다.

info threads

위 명령으로 thread 별 lwp pid를 확인할 수 있다.(LWP:LightWeight Process)

 

스레드 인덱스 별로 backtrace 할려면,

t 13    // 13은 스레드 인덱스

와 같이 하면 된다.

 

Posted by code cat

영문은

warning: overriding commands for target '...'


한글번역된 메세지는

경고: 타켓 '...'에 대한 명령어보다 다른 것이 우선합니다.


우선해서 어쩌라고..????????


이래서 overriding이 되는 줄 몰랐다.  왜 저렇게 번역했는지는 모르겠지만, 영문 메세지로 확인하니 overriding이 되는걸 확인 할 수 있었다.

'리눅스 > 스크립트/유틸' 카테고리의 다른 글

openssl 을 이용한 암호화 방법  (0) 2013.11.25
GDB  (0) 2013.09.24
[byobu] vertical line 없애기  (0) 2013.09.01
ubuntu에 설치된 패키지 리스트 보기  (0) 2013.07.25
[screen/byobu] 윈도우 숫자 바꾸기  (0) 2013.06.29
Posted by code cat

byobu를 쓰는 이유 중 하나가 바로 vertical line split 기능일 것이다. (나만 그럴 수도..)

물론 screen에도 vertical line patch가 있지만... byobu가 더 이쁘니까..


어쨌든, vertical line을 만들고 나서 없애는 방법에 대해서 몰라 그냥 죽이는 방법을 썼었는데, 오늘 찾아보니 다음과 같이 하면 vertical line을 없앨 수 있다.


ctrl + a :remove {enter}


역시 찾아보면 다 나온다...

Posted by code cat

다음의 명령어를 사용하면 된다.

 

dpkg --get-selections


Posted by code cat

오랜만에 쓰는 screen/byobu 글이다.

가끔 screen에서 여러개 창을 쓰다가 중간 걸 꺼버릴 때가 있다.


0@$bash 1@$bash 2@$bash 3@$bash 4@$bash 


저렇게 있음, 3번을 꺼 버릴 때가 있다. 그럼 


0@$bash 1@$bash 2@$bash 4@$bash 


0,1,2,4 이렇게 쓰는데, 먼가 좀 그렇다.

한동안 그려러니 하고 쓰다 맘먹고 찾아본 결과 숫자를 바꾸는 법을 알아냈다.


바꾸려는 윈도우(4번이겠지)에 가서

ctrl + a, :number 3

하면 4번 윈도우가 3번으로 바뀌어서,

0@$bash 1@$bash 2@$bash 3@$bash


로 바뀐다.


정식 방법은

ctrl + a, :number x


로 바꿀 숫자를 x에 넣으면 된다.


하하 속 시원하다.

Posted by code cat

os.path.basename(path)

 

>>>path="out/target/product/codecat/abc.txt"

>>>import os

>>>os.path.basename(path)

'abc.txt'

 

os.path.dirname(path)

 

>>>path="out/target/product/codecat/abc.txt"

>>>import os

>>>os.path.dirname(path)

'out/target/product/codecat'

'리눅스 > 스크립트/유틸' 카테고리의 다른 글

ubuntu에 설치된 패키지 리스트 보기  (0) 2013.07.25
[screen/byobu] 윈도우 숫자 바꾸기  (0) 2013.06.29
python, regular expression match  (0) 2013.04.28
python, tempfile.mkdtemp  (0) 2013.04.28
python, getopt  (0) 2013.04.21
Posted by code cat
re.match(pattern, string, flags=0)

If zero or more characters at the beginning of string match the regular expression pattern, return a corresponding MatchObject instance. Return None if the string does not match the pattern; note that this is different from a zero-length match.

Note that even in MULTILINE mode, re.match() will only match at the beginning of the string and not at the beginning of each line.

If you want to locate a match anywhere in string, use search() instead (see also search() vs. match()).


'리눅스 > 스크립트/유틸' 카테고리의 다른 글

[screen/byobu] 윈도우 숫자 바꾸기  (0) 2013.06.29
[파이썬] String 가지고 놀기  (0) 2013.06.04
python, tempfile.mkdtemp  (0) 2013.04.28
python, getopt  (0) 2013.04.21
python, pass statement  (0) 2013.04.17
Posted by code cat
출처:http://docs.python.org/2/library/tempfile.html

tempfile.mkdtemp([suffix=''[, prefix='tmp'[, dir=None]]])

Creates a temporary directory in the most secure manner possible. There are no race conditions in the directory’s creation. The directory is readable, writable, and searchable only by the creating user ID.

The user of mkdtemp() is responsible for deleting the temporary directory and its contents when done with it.

The prefix, suffix, and dir arguments are the same as for mkstemp().

mkdtemp() returns the absolute pathname of the new directory.

New in version 2.3.


tempfile.NamedTemporaryFile([mode='w+b'[, bufsize=-1[, suffix=''[, prefix='tmp'[, dir=None[, delete=True]]]]]])

This function operates exactly as TemporaryFile() does, except that the file is guaranteed to have a visible name in the file system (on Unix, the directory entry is not unlinked). That name can be retrieved from the name attribute of the file object. Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later). If delete is true (the default), the file is deleted as soon as it is closed.

The returned object is always a file-like object whose file attribute is the underlying true file object. This file-like object can be used in a with statement, just like a normal file.

New in version 2.3.

New in version 2.6: The delete parameter.


'리눅스 > 스크립트/유틸' 카테고리의 다른 글

[파이썬] String 가지고 놀기  (0) 2013.06.04
python, regular expression match  (0) 2013.04.28
python, getopt  (0) 2013.04.21
python, pass statement  (0) 2013.04.17
git 저장소 추가 시에 주의 할 점.  (0) 2013.03.24
Posted by code cat

getopt 는 c코딩에 익숙한 유저들을 위해 command line option을 parsing 하기 위해 지원하는 API이다.

정확히 sys.argv에 있는 argument들을 parsing하는데, unix conventions('-' , '--' 들의 차이점등) 들을 지원한다.

getopt는 아래의 두함수를 지원한다.


getopt.getopt(args, options[, long_options])

args = parsing 될 인자 리스트들이며, 실행 프로그램을 제외한다.  sys.argv[1:] 부터 시작되며, 즉 ota_from_target_files -x -d 일 경우, -x부터 시작한다는 말이다. 인자를 필요로 하는 옵션일 경우 : 이 붙는다.

long_options의 경우 '--' 는 옵션 이름에 포함되지 말아야 한다.  인자를 필요로 하는 경우, 인자는 '='뒤에 따라와야 한다.  long option만 받을라면, option 리스트가 비어야 있어야한다.

리턴 값은 두 종류이다.  첫번째는 (option, value)로 이루어진 리스트이며, 두번째는 option을 제외하고 남은 args들이다.  (option, value)의 첫번째 항목은 옵션이며, '-'를 prefix로 가지고 있다.  두번째 항목은 옵션에 해당하는 값이다.


getopt.gnu_getopt(args, options[, long_options])
getopt와 같으며, 대신 GNU style scanning을 지원한다.  즉 옵션 과 옵션이 아닌 인자들을 혼합해 사용 가능하다.


exception getopt.GetoptError알수 없는 옵션이거나, 인자가 필요한 옵션에 인자가 없을 경우 일어난다.   exception getopt.error
GetoptError 와 같으나, backward compatibility를 위해서 존재한다.

'리눅스 > 스크립트/유틸' 카테고리의 다른 글

python, regular expression match  (0) 2013.04.28
python, tempfile.mkdtemp  (0) 2013.04.28
python, pass statement  (0) 2013.04.17
git 저장소 추가 시에 주의 할 점.  (0) 2013.03.24
byobu detached 세션 죽이기  (0) 2013.03.13
Posted by code cat