기본 콘텐츠로 건너뛰기

4월, 2016의 게시물 표시

자바 스크립트 소수점 올림, 버림, 반올림

1. 소수점 올림, 버림, 반올림 Math.ceil() : 소수점 올림, 정수형 반환 Math.floor() : 소수점 버림, 정수형 반환 Math.round() : 소수점 반올림, 정수형 반환 var n = 123.456 ; alert(Math.ceil(n)); // 124 alert(Math.round(n)); // 123 n = 123.567 ; alert(Math.ceil(n)); // 124 alert(Math.floor(n)); // 123 alert(Math.round(n)); // 124

iptables

q 에 제대로 적용 되는지 확인 iptables -nv -L 옵션 iptables [-t table] command [match] [target\jump] -A(--append)            :  규칙을 추가한다. -N(--new-chain)        :  새로운 체인 생성 -X(--delete-chain)     :  체인 제거 -P(--policy)              :  체인 기본정책 변경 -L(--list)                  :  체인의 규칙상태 보기 -F(--flush)               :  체인내의 모든 규칙 제거(방화벽 초기화) -Z(--zero)                :  체인내의 모든 규칙의 패킷과 바이트의 카운트를 0으로 초기화 -D(--delete)             :  규칙을 삭제 -R(--replace)            :  새로운 규칙으로 대체 -I(--insert)               :  체인의 가장 처음에 규칙을 추가한다. -E(--rename-chain)    :  체인의 이름을 변경한다.

Putty 사용시 파란색 디렉토리 색상 변경

퍼온 주소 http://yangyag.tistory.com/291 Putty 사용시 디렉토리가 파란색으로 표시 되는데 잘 안보여서 확인하기가 어렵다. 다음과 같은 방법으로 변경 가능하다. [그림 1] Window - Colours 에서 ANSI Blue 를 선택 후 [그림 1] 과 같이 색상을 정해준다. [그림 2] Window - Colours 에서 ANSI Blue Bold 를 선택 후 [그림 2] 과 같이 색상을 정해준다. [그림 3] Session 에서 최종적으로 Save 해 준다.

우분투 네트웍 설정

sudo vi /etc/network/interfaces auto lo eth0 iface lo inet loopback iface eth0 inet dynamic 고정 IP 변경 auto lo eth0 iface lo inet loopback iface eth0 inet static address 192.168.1.101 netmask 255.255.255.0 gateway 192.168.1.1 sudo vi /etc/resolv.conf nameserver 8.8.8.8 재시작 sudo /etc/init.d/networking restart 이게 안되는 경우 $ sudo service networking restart $  sudo ifdown eth0 && sudo ifup eth0 eth0 명치 변경하기 cat /etc/udev/rules.d/70-persistent-net.rules

MariaDB(mysql) 명령어

DB 생성 MariaDB [(none)]> show databases; MariaDB [(none)]> create database example_db; MariaDB [mysql]> drop database example_db; 설치 위치 보기 SHOW VARIABLES WHERE Variable_Name LIKE "%dir" 케릭터 정보 보기 SHOW VARIABLES LIKE 'c%' 접속수 늘리기 set global max_connections=300; [mysql]    default-character-set=utf8 [mysqld]    character-set-client-handshake = FALSE   init_connect = "SET collation_connection = utf8_general_ci"   init_connect = "SET NAMES utf8"   character-set-server = utf8   collation-server = utf8_general_ci   [client]     default-character-set = utf8   [mysqldump]     default-character-set = utf8 접속 $ mysql -u 사용자명 -p dbname $ mysql> USE dbname; 테이블 생성 mysql> CREATE TABLE tablename ( column_name1 INT, column_name2 VARCHAR(15), column_name3 INT ); 테이블 목록 보기 mysql> SHOW TABLES; 현재 상태 보기 mysql> status 오류 경고 보기 mysql> show errors; mysql> show warnings

우분투에 root 계정과 암호를 만들기

프롬프트에서 sudo passwd root 라고 합니다. 주의! 위에서 "passwd"라는 문자열은 진짜 암호가 아니라 문자 그대로 입력해야 합니다. 만약 패스워드가 foo 라고 해서 sudo foo root 이렇게 하면 안됩니다. 정확히  sudo passwd root  이렇게 적어 주어야 합니다. 그러면 현재 암호를 먼저 묻습니다. 현재 로그인한 ID의 암호를 한번 입력해 주면 이제 Enter new UNIX password: 라고 나오며 root 의 암호를 2번 묻습니다. 새 암호를 만들어 적어 주면 됩니다. vi  /etc/ssh/sshd_config 변경 PermitRootLogin yes service ssh restart

HowTo manage Mellanox Linux Driver modules and RPMs

HowTo manage Mellanox Linux Driver modules and RPMs ?? 3 2015. 7. 24 ?? 4:27?  ophirmaor    ?? ???, 2015. 8. 19 ?? 3:35?  ophirmaor    ?? ????? ??????. This post shows various of commands to manage the Linux driver modules and PRMs. This post is basic and meant for beginners. References HowTo Find the Logical-to-Physical Port Mapping (Linux) Mellanox Linux Driver Modules Relationship (MLNX_OFED) Linux rpm cheat sheet Note : in different OS distributions the output may be different. Kernel Module management Use the following commands: lsmod modprobe modinfo For example: lsmod #  lsmod | grep ib ib_ucm                 22546  0 ib_ipoib              136649  0 ib_uverbs              66467  2 ib_ucm,rdma_ucm ib_umad                22221  0 mlx5_ib               142352  0 mlx5_core             108415  1 mlx5_ib mlx4_ib               200149  0 mlx4_core             336659  2 mlx4_en,mlx4_ib ib_iser                52192  0