Linux2017. 2. 15. 19:31

약간 다른 상황이지만..

임베디드 리눅스에서 minicom도 없고 screen도 없어서

순수(?) 터미널로만 받는 방법 찾게 됨

 

stty -speed 19200 -f /dev/ttyS1

 

echo -ne '\033[2J' > /dev/ttyS1

cat -v < /dev/ttyS1 

[링크 : http://unix.stackexchange.com/questions/117037/how-to-send-data-to-a-serial-port-and-see-any-answer]

 

일단 안되서! 명령어 도움말을 보니

# stty --help

BusyBox v1.20.2 (2015-12-21 15:35:08 KST) multi-call binary.

 

Usage: stty [-a|g] [-F DEVICE] [SETTING]...

 

Without arguments, prints baud rate, line discipline,

and deviations from stty sane

 

        -F DEVICE       Open device instead of stdin

        -a              Print all current settings in human-readable form

        -g              Print in stty-readable form

        [SETTING]       See manpage 

 

# stty -a -F /dev/ttyAMA2

speed 9600 baud;stty: /dev/ttyAMA2

 line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;

eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;

werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff

-iuclc -ixany -imaxbel -iutf8

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt

echoctl echoke 

 

# stty -F /dev/ttyAMA2 speed 115200

9600 

 

# stty -a -F /dev/ttyAMA2

speed 115200 baud;stty: /dev/ttyAMA2

 line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;

eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;

werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff

-iuclc -ixany -imaxbel -iutf8

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt

echoctl echoke 

 

putty에서 시리얼 열어 놓고

baudrate 맞추고 하니 잘 된다.

다만.. 232가 아닌 485라.. RX만 확인하고 TX는 아직 미확인 ㅠㅠ

 

 

+

바로 종료되서 글씨가 안나오면 아래와 같이 타임아웃 시간을 늘려주는 것이 방법이다.

# stty -F /dev/ttyAMA2 min 0 time 10 

 

[링크 : http://stackoverflow.com/questions/6713668/how-i-can-read-tty-file-with-timeout]

 

 

+

2021.02.18

부등호 방향에 유의 ㅠㅠ

stty 115200 < /dev/ttyS0

[링크 : https://iam777.tistory.com/490]

'Linux' 카테고리의 다른 글

wget 로그인 정보 설정  (0) 2017.04.17
원격지 mac address 얻기  (0) 2017.03.13
리눅스 파일 시간관련  (0) 2017.01.01
ctime mtime.. 엌?!  (0) 2016.12.31
base64 유틸리티  (0) 2016.12.28
Posted by 구차니

운이 좋은건지 모르겠지만.. 출퇴근 길에 2층 버스가 1대 도입되서 타고 다니는데

요즘 늑장이 늘었는지 매번 2층 버스 타는 기행(?)을 벌어지는 중...

아무튼 2층 버스 첨에는 신기한데 탈수록 불만인게 늘어나는 중



1. 낮아!!!

내 키가 168인데 2층에서는 머리카락 닿는 느낌 170 넘으면 무릎을 굽혀야 할 듯?

(참고로 캔버스 같은 바닥이 얕은 녀석이라  정말 끽해야 172cm 정도 높이가 될 느낌)

1층은 180cm 넘으면 상당히 괴로울 낮은 높이


2. 눈부셔!!!

망할 LED 등에 천장이 낮은 문제의 결합으로, 자려고 하기에는 드럽게 밝다 -_-

모자달린 잠바는 필수!


3. 좁아!!!

일단 세보진 않았지만 1층 약 15 좌석 2층 55석 정도 합쳐서 70석 정도 될거 같은데

1층 버스가 45명 뜨는거 봐서는 한 좌석 자리가 좁은건 안봐도 비디오

그래서 패딩까지 입고 나만큼 덩치 큰 남자 둘이 앉으면 보기 괴로울 정도 -_ㅠ


4. 느려!!!

자면서 가다 보니 대충 시간이나 급 커브 지역을 기준으로 깨는데.. 확실히 시간으로 깨면 덜 감..

속도제한이 걸린건지 아직 새차라 그런지 차고가 높아서 그런지 1층 버스 보다 얌전히 운전하심


5. 앞자리가 명당이 아냐!!!

1층은 좁고(벽쪽에 전광판등으로 인해 창턱에 손을 못 걸치니) 2층은... 춥고 앞이 좁다

그래서 처음에는 다들 신기해서 그 자리에 먼저 타더니 이제 두달 지나니 가장 늦게차는 편




개인적으로 눈부신데 좁은게 치명타



다만 장점은...

1. 부드럽게 달림

속도가 느리게 달리는것과 연관이 있는거 같은데, 2층에서도 확실히 출렁이거나 덜컹이는게 적다.

완충장치가 더 좋은건가...



적고보니 단점만 느껴지는 기분이네 ㅋㅋㅋ


Posted by 구차니

생각을 해보니..

차단될때 마다 blacklist 파일에 추가해주면

다음번 재시작 시에 blacklist를 보고 자동으로 DROP 하도록 되어 있으니

REJECT 하는 자동 차단이랑 섞어서 쓰면 쓸만할지도?!


$ cat /etc/fail2ban/action.d/iptables-multiport24.conf

actionban = iptables -I fail2ban-<name> 1 -s <ip>/24 -j <blocktype>

            echo <ip> >> /etc/fail2ban/ip.blacklist 


'프로그램 사용 > fail2ban' 카테고리의 다른 글

fail2ban ssh 차단 실패???  (0) 2017.03.06
fail2ban phpmyadmin  (0) 2017.02.28
fail2ban 차단 관련...  (0) 2017.02.09
ssh 로그인 보안 - fail2ban  (4) 2017.02.08
apache ip deny  (0) 2017.02.08
Posted by 구차니
Linux/Ubuntu2017. 2. 15. 14:50

음.. 프로세스 별로 처리인가?

유저별로 제한이라던가 하는 기능은 없나보네..


$ cpulimit

Error: You must specify a target process

CPUlimit version 2.1

Usage: cpulimit TARGET [OPTIONS...] [-- PROGRAM]

   TARGET must be exactly one of these:

      -p, --pid=N        pid of the process

      -e, --exe=FILE     name of the executable program file

                         The -e option only works when

                         cpulimit is run with admin rights.

      -P, --path=PATH    absolute path name of the

                         executable program file

   OPTIONS

      -b  --background   run in background

      -c  --cpu=N        override the detection of CPUs on the machine.

      -l, --limit=N      percentage of cpu allowed from 1 up.

                         Usually 1 - 400, but can be higher

                         on multi-core CPUs (mandatory)

      -q, --quiet        run in quiet mode (only print errors).

      -k, --kill         kill processes going over their limit

                         instead of just throttling them.

      -r, --restore      Restore processes after they have

                         been killed. Works with the -k flag.

      -s, --signal=SIG   Send this signal to the watched process when cpulimit exits.

                         Signal should be specificed as a number or

                         SIGTERM, SIGCONT, SIGSTOP, etc. SIGCONT is the default.

      -v, --verbose      show control statistics

      -z, --lazy         exit if there is no suitable target process,

                         or if it dies

          --             This is the final CPUlimit option. All following

                         options are for another program we will launch.

      -h, --help         display this help and exit 


[링크 : http://cpulimit.sourceforge.net/]

[링크 : https://www.howtoforge.com/how-to-limit-cpu-usage-with-cpulimit-on-ubuntu-linux]

[링크 : https://www.digitalocean.com/community/tutorials/how-to-limit-cpu-usage-on-ubuntu-12-10]

[링크 : http://manpages.ubuntu.com/manpages/precise/man1/cpulimit.1.html]



+

ulimit을 통해 전체 시스템에 대해서 일괄적으로 cpu및 메모리 등의 용량 제한을 걸 수 있는 듯?


[링크 : http://www.linuxquestions.org/questions/linux-server-73/how-to-limit-the-users-cpu-usage-617928/]

    [링크 : http://www.linuxquestions.org/questions/debian-26/how-to-limit-the-cpu-usage-per-user-715490/]

[링크 : http://stackoverflow.com/questions/437433/limit-the-memory-and-cpu-available-for-a-user-in-linux]

[링크 : https://linux.die.net/man/3/ulimit]


<item>

core

limits the core file size (KB)

data

maximum data size (KB)

fsize

maximum filesize (KB)

memlock

maximum locked-in-memory address space (KB)

nofile

maximum number of open files

rss

maximum resident set size (KB) (Ignored in Linux 2.4.30 and higher)

stack

maximum stack size (KB)

cpu

maximum CPU time (minutes)

nproc

maximum number of processes

as

address space limit (KB)

maxlogins

maximum number of logins for this user except for this with uid=0

maxsyslogins

maximum number of all logins on system

priority

the priority to run user process with (negative values boost process priority)

locks

maximum locked files (Linux 2.4 and higher)

sigpending

maximum number of pending signals (Linux 2.6 and higher)

msgqueue

maximum memory used by POSIX message queues (bytes) (Linux 2.6 and higher)

nice

maximum nice priority allowed to raise to (Linux 2.6.12 and higher) values: [-20,19]

rtprio

maximum realtime priority allowed for non-privileged processes (Linux 2.6.12 and higher) 


[링크 : https://linux.die.net/man/5/limits.conf]

'Linux > Ubuntu' 카테고리의 다른 글

cgroups  (0) 2017.08.24
리눅스 하드 절전 설정  (0) 2017.05.23
우분투 루트 인증서 업데이트 내역  (0) 2017.01.18
우분투 창 관리 - 윈7처럼 창분할 단축키  (0) 2017.01.09
crontab 과 cron 서비스 reload  (0) 2017.01.04
Posted by 구차니

국민은행에서 창구고객에게 수수료 물린다는데

가끔 어쩔수 없이 인터넷으로 안되서 창구로 가서 하는데도

엄청 줄이 길고(물론 직딩이라 점심시간을 이용할수 밖에 없어서..)

온갖 동의 사인에 시간도 너무 걸리는데

그런 불편함을 해소할 방법도 없이 창구고객에게 입출금시 돈을 받는다고 하면 참 어이가 없네

그러면 24시간 ATM기 가동에 ATM은 수수료 0원으로 무조건 강제 하는 식으로

정부에서 제한을 할 필요가 있는거 아닌가 싶기도 하고


근데 대한민국이잖아? 안될거야

[링크 : http://v.media.daum.net/v/20170214184546571]

[링크 : http://v.media.daum.net/v/20170214160450635]

Posted by 구차니

EOS M3는 솔찍히 포커스 속도 관련 펌웨어 업데이트 된거랑 크게 차이가 없는 느낌이라고 해야하나

줌을 다른걸로 해서 정확한 비교는 아니지만,

막상 사서 쓰기에는 미미한 성능 차이라 웬지 M3는 그닥.. 이라는 느낌


그리고 소니 A7 EVF를 보는데 화소가 안보이는 신기함 ㄷㄷ

예전의 EVF가 아니구나 라는걸 느끼는 하루..




+

굳이 카메라를 산다면.. 라는 가정이 들어갈 이유가 있을지 모르겠지만

다음번에는 캐논 말고 다른걸 한번 살지도 모르겠다. 소니라던가?

근데 소니는 중고가 빨리 떨어진다니까.. 조금 기다렸다가 소니 미러리스를 노려보게 되려나? ㅋㅋ

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

운전하다가 드는 뻘생각  (0) 2017.02.16
출퇴근 길 2층 버스...  (0) 2017.02.15
소득공제 돌려보니 뱉으라네?!?!? ㅠㅠ  (0) 2017.01.31
아 내일 출근하기 싫다  (0) 2017.01.30
설 끝 ?  (0) 2017.01.28
Posted by 구차니

음.. 웹쪽이야 svn으로 하면되는데

db의 구조가 변경되는건 어떻게 이력으로 남길수 있지?

라는 생각이 들어 검색을 해보니


결론은.. db 스키마 덤프해서 버전관리해라 정도의 느낌?

[링크 : https://blog.codinghorror.com/get-your-database-under-version-control/]

[링크 : https://blog.codinghorror.com/is-your-database-under-version-control/] <<


[링크 : http://stackoverflow.com/questions/115369/do-you-use-source-control-for-your-database-items]

[링크 : http://stackoverflow.com/questions/175451/how-do-you-version-your-database-schema]

[링크 : http://stackoverflow.com/questions/173/versioning-sql-server-database]

'프로그램 사용 > mysql & mariaDB' 카테고리의 다른 글

mysql view  (0) 2017.03.14
db designer  (0) 2017.03.14
mysql 통화관련 변수타입  (0) 2017.02.07
mysql 다국어 문자길이  (0) 2017.02.06
mysql select case insensitive  (0) 2017.02.06
Posted by 구차니
프로그램 사용/vi2017. 2. 13. 09:37

:ls 버퍼 목록

:bn buffer next

:bp buffer previous

:b0 0번째로 이동

:bf buffer first 처음

:bl buffer last 마지막


:[N]bn[ext][!] [+cmd] [N]                               *:bn* *:bnext* *E87*

                Go to [N]th next buffer in buffer list.  [N] defaults to one.

                Wraps around the end of the buffer list.

                See |:buffer-!| for [!].

                Also see ||+cmd|.

                If you are in a help buffer, this takes you to the next help

                buffer (if there is one).  Similarly, if you are in a normal

                (non-help) buffer, this takes you to the next normal buffer.

                This is so that if you have invoked help, it doesn't get in

                the way when you're browsing code/text buffers.  The next three

                commands also work like this. 


bN이 대문자임

:[N]bN[ext][!] [+cmd] [N]               *:bN* *:bNext* *:bp* *:bprevious* *E88*

:[N]bp[revious][!] [+cmd] [N]

                Go to [N]th previous buffer in buffer list.  [N] defaults to

                one.  Wraps around the start of the buffer list.

                See |:buffer-!| for [!] and 'switchbuf'.

                Also see ||+cmd|. 


:br[ewind][!] [+cmd]                                    *:br* *:brewind*

                Go to first buffer in buffer list.  If the buffer list is

                empty, go to the first unlisted buffer.

                See |:buffer-!| for [!].


:bf[irst] [+cmd]                                        *:bf* *:bfirst*

                Same as |:brewind|.

                Also see |+cmd|. 


:bl[ast][!] [+cmd]                                      *:bl* *:blast*

                Go to last buffer in buffer list.  If the buffer list is

                empty, go to the last unlisted buffer.

                See |:buffer-!| for [!]. 


:[N]bd[elete][!]                        *:bd* *:bdel* *:bdelete* *E516*

:bd[elete][!] [N]

                Unload buffer [N] (default: current buffer) and delete it from

                the buffer list.  If the buffer was changed, this fails,

                unless when [!] is specified, in which case changes are lost.

                The file remains unaffected.  Any windows for this buffer are

                closed.  If buffer [N] is the current buffer, another buffer

                will be displayed instead.  This is the most recent entry in

                the jump list that points into a loaded buffer.

                Actually, the buffer isn't completely deleted, it is removed

                from the buffer list |unlisted-buffer| and option values,

                variables and mappings/abbreviations for the buffer are

                cleared. 


:[N]bw[ipeout][!]                       *:bw* *:bwipe* *:bwipeout* *E517*

:bw[ipeout][!] {bufname}

:N,Mbw[ipeout][!]

:bw[ipeout][!] N1 N2 ...

                Like |:bdelete|, but really delete the buffer.  Everything

                related to the buffer is lost.  All marks in this buffer

                become invalid, option settings are lost, etc.  Don't use this

                unless you know what you are doing. 


[링크 : http://gyuha.tistory.com/157]


+

ctrl-n,n은 새 버퍼로 수평 창을 여는데

ctrl-n,v는 이전 창의 버퍼를 연결해서 수직 창으로 연다


 CTRL-W CTRL-V                                           *CTRL-W_CTRL-V*

CTRL-W v                                                *CTRL-W_v*

:[N]vs[plit] [++opt] [+cmd] [file]                      *:vs* *:vsplit*

                Like |:split|, but split vertically.  The windows will be

                spread out horizontally if

                1. a width was not specified,

                2. 'equalalways' is set,

                3. 'eadirection' isn't "ver", and

                4. one of the other windows is wider than the current or new

                   window.

                Note: In other places CTRL-Q does the same as CTRL-V, but here

                it doesn't!


CTRL-W n                                                *CTRL-W_n*

CTRL-W CTRL_N                                           *CTRL-W_CTRL-N*

:[N]new [++opt] [+cmd]                                  *:new*

                Create a new window and start editing an empty file in it.

                Make new window N high (default is to use half the existing

                height).  Reduces the current window height to create room (and

                others, if the 'equalalways' option is set and 'eadirection'

                isn't "hor").

                Also see |++opt| and |+cmd|.

                If 'fileformats' is not empty, the first format given will be

                used for the new buffer.  If 'fileformats' is empty, the

                'fileformat' of the current buffer is used.  This can be

                overridden with the |++opt| argument.

                Autocommands are executed in this order:

                1. WinLeave for the current window

                2. WinEnter for the new window

                3. BufLeave for the current buffer

                4. BufEnter for the new buffer

                This behaves like a ":split" first, and then an ":enew"

                command.


:[N]vne[w] [++opt] [+cmd] [file]                        *:vne* *:vnew*

                Like |:new|, but split vertically.  If 'equalalways' is set

                and 'eadirection' isn't "ver" the windows will be spread out

                horizontally, unless a width was specified.


:[N]new [++opt] [+cmd] {file}

:[N]sp[lit] [++opt] [+cmd] {file}                       *:split_f*

                Create a new window and start editing file {file} in it.  This

                behaves like a ":split" first, and then an ":e" command.

                If [+cmd] is given, execute the command when the file has been

                loaded |+cmd|.

                Also see |++opt|.

                Make new window N high (default is to use half the existing

                height).  Reduces the current window height to create room

                (and others, if the 'equalalways' option is set).



[링크 : http://stackoverflow.com/.../vim-how-do-you-open-another-no-name-buffer-like-the-one-on-startup]

'프로그램 사용 > vi' 카테고리의 다른 글

vi 여러개 파일 편집하기(동시 x)  (0) 2017.09.16
vi 반복 입력  (0) 2017.09.16
vi buffer window tab 차이점?  (0) 2017.02.11
vi 창 분할해서 보기  (0) 2017.02.10
vi 현재 위치에서 끝까지 복사  (0) 2017.02.01
Posted by 구차니
embeded/AVR (ATmega,ATtiny)2017. 2. 12. 20:07

대충보는데

링커에서 개별 오브젝트 파일의 상대주소나 절대주소를 변경해줄수 있는데

hex파일로 바뀐건 이미 링커의 결과물이라

임의로 변경은 힘들지도?


그럼 hex를 objdump로 object 파일로 덤프해서 다시 링커로 연결하면서 주소를 바꿀수 있을려나?

hex는 bin의 ascii 표현법이고

hex2bin으로 바이너리로 환원하고 다시 링커로 해주면 되려나


[링크 : http://www.avrfreaks.net/forum/how-link-bootloaderhex-applicationelf]


걍 찾아봐도 안나오는거 봐서는.. 그리 권장할 만한 아이디어가 아닌건가?

아니면 리버스목적이 아닌 이상 쓸모가 없는 방법이라서 그런걸까?

'embeded > AVR (ATmega,ATtiny)' 카테고리의 다른 글

avr pwm 관련  (0) 2017.04.19
IAR AVR은 start section 설정이 안되나?  (0) 2017.02.17
우리로봇기술 사이트 폐쇄  (0) 2016.08.24
avr iar __flash winavr PROGMEM  (0) 2016.07.06
부품들 정리  (0) 2016.04.16
Posted by 구차니
프로그램 사용/vi2017. 2. 11. 16:27

사용에 옳은 방법이 있겠냐 마는

버퍼는 일종의 파일 하나당 할당된 메모리 개념 같고

윈도우는 버퍼를 골라서 띄우는 역할

그리고 탭은 윈도우에서 레이아웃을 담당하는 역할이라고 하는데

솔찍히 탭 + 윈도우로 쓰긴 또 에러고

가장 무난한건 윈도우 여러개 분할해서 버퍼 골라가며 쓰는거?


[링크 : http://bakyeono.net/post/2015-08-13-vim-tab-madness-translate.html]


[링크 : https://sanctum.geek.nz/arabesque/buffers-windows-tabs/]

[링크 : http://stackoverflow.com/questions/26708822/why-do-vim-experts-prefer-buffers-over-tabs]

'프로그램 사용 > vi' 카테고리의 다른 글

vi 반복 입력  (0) 2017.09.16
vi 버퍼 컨트롤  (0) 2017.02.13
vi 창 분할해서 보기  (0) 2017.02.10
vi 현재 위치에서 끝까지 복사  (0) 2017.02.01
vi 단어 단위 이동  (0) 2017.02.01
Posted by 구차니