Archive for the ‘Tips’ Category

쿠키 사용 - 체크시 오늘 하루동안 새창 열지 않기

월요일, 2월 9th, 2009

http://webnoon.net/entry/%EC%B2%B4%ED%81%AC%EC%8B%9C-%EC%98%A4%EB%8A%98-%ED%95%98%EB%A3%A8%EB%8F%99%EC%95%88-%EC%83%88%EC%B0%BD-%EC%97%B4%EC%A7%80-%EC%95%8A%EA%B8%B0

 

set cookie, get cookie가 관건

나머지는 통상적인 자바문법

dhtml윈도로 창 안의 팝업창 만들기

월요일, 2월 9th, 2009

http://www.dynamicdrive.com/

여기서 검색하면 됩니다.

image

Ubuntu에서 하드디스크 사양 보기

화요일, 2월 3rd, 2009

그 용도로만 쓰는 건 아니지만 smartmon이 있습니다. (hdparm으로 못보는 LVM 으로 설정된 디스크도 잘 보이네요)

# apt-get smartmontools

# smartctl -a /dev/sda

하면 됩니다.

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Caviar RE Serial ATA series
Device Model:     WDC WD5000YS-70VJB1
Serial Number:    ……………………
Firmware Version: 00.0HPG0
User Capacity:    500,107,862,016 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   7
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:    Tue Feb  3 12:24:00 2009 KST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

 

http://www.howtoforge.com/checking-hard-disk-sanity-with-smartmontools-debian-ubuntu

나눔코딩폰트

금요일, 1월 23rd, 2009

개발자용 나눔고딕 코딩글꼴 공개~ 에서 보고 테스트해봤습니다.

 

콘솔라스 쓰다가 써본 첫 느낌은

위아래로 길다.

폭이 좁아서 폰트를 기존 12에서 14로 키워서 쓰는 게 눈이 편하군요.

약간의 버그?

Xming + gnome-terminal에서 쓰니 셸에서 커서를 움직일 때 화살표키로 움직이면 커서 너비가 두배로 보입니다.

한글은 확실히 예쁘다

기존 영문 폰트들에 비해 역시 한글이 들어있으니, 미려하게 나옵니다.

nanum_gnome

그림 설명 : Xming + Gnome-terminal 입니다. 폰트크기 14. 옆으로 좁고 위아래가 깁니다.

 

nanum_gnome_cursor

그림 설명 : 커서 버그? 일지도 모르겠습니다. consolas 쓰면 안그런데

nanum_gnome_hangul

그림 설명 : 한글은 확실히 맘에 듭니다.

비교군으로 콘솔라스 쓴 화면. (한글 폰트는 뭐더라??..)

consolas_gnome_hangul

scponly를 이용해서 sftp만 제공하고 chroot로 다른 디렉토리 접근 막기

목요일, 1월 22nd, 2009

http://ubuntuforums.org/showthread.php?t=451510 (원래 포스트)

http://geekzine.org/2007/09/28/easy-sftp-and-chroot-sftp-with-scponly/

항상 실패했었는데 좋은 패키지가 있군요

외부 사용자에게 셸은 안주고 sftp만 제공해서 다운로드/업로드만 되게 하고 싶을 때가 있습니다. ftp는 보안상 피하고 싶구요.

그때 잘 쓸 수 있겠네요.

간단하게 설명하면 (데비안/우분투 기준입니다)

1. scponly 패키지를 설치한다.

2. 거기서 제공하는 스크립트로 chroot jail을 만들고 사용자를 추가한다.

끝.

입니다.

자세한 설명은 위 링크에 돼 있구요

제가 한 스샷과 함께 보면,

1. scponly 패키지 설치

$ sudo apt-get install scponly

이러면 됩니다.

테스트로 일단 테스트할 사용자를 만들었다 치고

그 사용자의 shell을 scponly로 바꿔줍니다.

$ sudo chsh -s /usr/bin/scponly username

그리고 sftp 해보기

$ sftp username@서버

image

2. Chroot로 경로 제한해주기

chroot로 안해주면 sftp로 서버의 모든 경로를 다 이동해다닐 수 있습니다.

꼭 해줘야겠죠.

$ sudo dpkg-reconfigure -plow scponly

해줍니다. 그러면 뭐라뭐라 경고가 뜰텐데. chroot쓸라면 꼭 suid를 세팅 해야 하기 때문입니다. yes를 선택

image

그리고 제공된 스크립트를 압축 풀어서 실행해줍니다.

$ cd /usr/share/doc/scponly/setup_chroot
$ sudo gunzip setup_chroot.sh.gz
$ sudo chmod +x setup_chroot.sh
$ sudo ./setup_chroot.sh

실행하면 새로 추가할 사용자 이름, chroot 경로등을 물어보고 셋업해줍니다.

image

암호까지 입력했으면 이제 셋업 된 겁니다.

접속해봅시다 ^^

우분투에선(저는 8.04) 잘 되는데 제 VM(데비안) 오류가 나네요

아항~ 보니깐 dev/null이 없어요. 아마 데비안의 버전에서 스크립트 버그인 듯.

$ mkdir /home/scponly/dev
$ mknod -m 666 /home/scponly/dev/null c 1 3

이렇게 하니 접속 되네요.

image

그리고 유저 이름이 긴 경우인 것 같은데 winscp에서 에러메시지 같은게 납니다.(제가 테스트한 데비안 버전의 경우)

이 때는 제공된(/usr/share/doc/scponly/group.c)를 빌드해서 카피해주면 되나봐요. 그러나 쓰는 데 문제 없는 거 같아서 놔뒀습니다.

/proc/meminfo 내용 [Red Hat] 자료

화요일, 1월 20th, 2009

출처 : http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/en-US/Reference_Guide/s2-proc-meminfo.html

/proc/meminfo 내용

This is one of the more commonly used files in the /proc/ directory, as it reports a large amount of valuable information about the systems RAM usage.

The following sample /proc/meminfo virtual file is from a system with 256 MB of RAM and 512 MB of swap space:

         MemTotal: 255908 kB MemFree: 69936 kB Buffers: 15812 kB Cached: 115124 kB SwapCached: 0 kB Active: 92700 kB Inactive: 63792 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 255908 kB LowFree: 69936 kB SwapTotal: 524280 kB SwapFree: 524280 kB Dirty: 4 kB Writeback: 0 kB Mapped: 42236 kB Slab: 25912 kB Committed_AS: 118680 kB PageTables: 1236 kB VmallocTotal: 3874808 kB VmallocUsed: 1416 kB VmallocChunk: 3872908 kB HugePages_Total: 0 HugePages_Free: 0 Hugepagesize: 4096 kB       

Much of the information here is used by the free, top, and ps commands. In fact, the output of the free command is similar in appearance to the contents and structure of /proc/meminfo. But by looking directly at /proc/meminfo, more details are revealed:

  • MemTotal — Total amount of physical RAM, in kilobytes.

  • MemFree — The amount of physical RAM, in kilobytes, left unused by the system.

  • Buffers — The amount of physical RAM, in kilobytes, used for file buffers.

  • Cached — The amount of physical RAM, in kilobytes, used as cache memory.

  • SwapCached — The amount of swap, in kilobytes, used as cache memory.

  • Active — The total amount of buffer or page cache memory, in kilobytes, that is in active use. This is memory that has been recently used and is usually not reclaimed for other purposes.

  • Inactive — The total amount of buffer or page cache memory, in kilobytes, that are free and available. This is memory that has not been recently used and can be reclaimed for other purposes.

  • HighTotal and HighFree — The total and free amount of memory, in kilobytes, that is not directly mapped into kernel space. The HighTotal value can vary based on the type of kernel used.

  • LowTotal and LowFree — The total and free amount of memory, in kilobytes, that is directly mapped into kernel space. The LowTotal value can vary based on the type of kernel used.

  • SwapTotal — The total amount of swap available, in kilobytes.

  • SwapFree — The total amount of swap free, in kilobytes.

  • Dirty — The total amount of memory, in kilobytes, waiting to be written back to the disk.

  • Writeback — The total amount of memory, in kilobytes, actively being written back to the disk.

  • Mapped — The total amount of memory, in kilobytes, which have been used to map devices, files, or libraries using the mmap command.

  • Slab — The total amount of memory, in kilobytes, used by the kernel to cache data structures for its own use.

  • Committed_AS — The total amount of memory, in kilobytes, estimated to complete the workload. This value represents the worst case scenario value, and also includes swap memory.

  • PageTables — The total amount of memory, in kilobytes, dedicated to the lowest page table level.

  • VMallocTotal — The total amount of memory, in kilobytes, of total allocated virtual address space.

  • VMallocUsed — The total amount of memory, in kilobytes, of used virtual address space.

  • VMallocChunk — The largest contiguous block of memory, in kilobytes, of available virtual address space.

  • HugePages_Total — The total number of hugepages for the system. The number is derived by dividing Hugepagesize by the megabytes set aside for hugepages specified in /proc/sys/vm/hugetlb_pool. This statistic only appears on the x86, Itanium, and AMD64 architectures.

  • HugePages_Free — The total number of hugepages available for the system. This statistic only appears on the x86, Itanium, and AMD64 architectures.

  • Hugepagesize — The size for each hugepages unit in kilobytes. By default, the value is 4096 KB on uniprocessor kernels for 32 bit architectures. For SMP, hugemem kernels, and AMD64, the default is 2048 KB. For Itanium architectures, the default is 262144 KB. This statistic only appears on the x86, Itanium, and AMD64 architectures.

Man page를 pdf로 출력

토요일, 1월 10th, 2009

man의 옵션인 -t를 사용

그리고 ps2pdf를 씁니다.

 

$ man -t ioctl > ioctl.ps  # 자기 로케일에 따른 출력. 한글이 나오면 pdf에서 깨질 수 있음.

또는

$ man -t -L C ioctl > ioctl.ps   # 영문으로

이후

$ ps2pdf ioctl.ps

만들어진 PDF파일 모습

핸드폰으로 3자 통화하기

목요일, 1월 1st, 2009

3명이 통화할 때

KTF의 경우 회의통화라고 불립니다

전화를 일단 한사람에게 겁니다.

통화하다가

[통화] * 2 2

누르고

전화번호 누르고 [통화]

그렇게 해서 걸리면 다시 [통화]

하면 됩니다.

셋이 통화할 수 있음

통화료 나오고 다른 비용은 없음

던파 vmware에서 실행

화요일, 12월 9th, 2008

VMWare player를 깐다(무료임)

vmx builder(무료임)로 가상머신 설정 vmx 파일을 만든다

이 때 할 일

네트웍 디바이스 추가(NAT로)
하드디스크 추가
CD드라이브 추가 & 윈도우 iso 이미지로 함
그래픽 카드 옵션 -> 32메가 메모리에 direct3d 켬

일단 켜서 윈도우를 설치한다(윈도우 이미지가 커스텀 세팅돼있는걸 쓰면 편함 **에디션)

백신도 설치하자

다 설치되면 vmware tools를 설치

이건 vmware 상용판의 trial판을 압축 풀어보면 windows.iso란 파일이 있다
이걸 가져다가 가상머신의 CD 드라이브에 올려둔다

가상머신을 다시 부팅해서 CD를 실행시키면 vmware tools가 깔린다

다시 재부팅

던전 파이터 홈페이지에 가서 로그인 후 게임 시작

image

(사실 아직 설치되는 것까지 보고있는 중 실행은 해봐야..)

컴파일러에서 제공하는 기본 설정 매크로 한 번에 보기

화요일, 11월 18th, 2008

gcc -v -E -dM - < /dev/null

이 명령치면 기본 설정된 매크로 가 한 번에 보입니다

http://kldp.org/node/99917

-v는 불필요합니다.

본문과 관련이 있을 것 같은 URL 올립니다.

* http://predef.sourceforge.net/
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/prepr_18.asp

image