manywaypark's Blog
개발, 검색, 함수

파일이 삼천만개면 너무 많은 건가? --;

파일들의 개수가 많아지면, 참기 힘들 정도로 속도가 저하된다.
apt-get 등으로 정상적인 시스템 관리(package update 등)하기도 너무 느려서 짜증날 정도다.

관리의 편의를 위해 많은 삽질 끝에 자동으로 대량의 데이터 파일들을 .deb 파일로 만들어서 간편하게 설치하는 방식을 현재 진행중인 프로젝트에 적용했으나, 속도 문제로 다른 방법을 찾아야할 듯하다.

예:
# dpkg -r some-pkg
(Reading database ... 36070717 files and directories currently installed.)
Removing some-pkg ...

위에 보이는 패키지 하나 삭제하는 데에 몇십분은 걸리는 듯하다. Orz.

happy hackin'




[TIP] putty가 갑자기 멈출 때...

tips & tricks 2007. 12. 3. 16:27 by manywaypark
putty를 이용하여 작업중에 연결이 끊긴 것도 아닌데 갑자기 멈추는 경우가 있을 수 있다.
ctrl-s를 누르면 XOFF 신호가 전송되는데 이때는 터미널에 입력되거나 출력되는 문자를 보여주지 않는다.
해법은 간단하다 ctrl-q 하면 XON 신호를 전송해서 그동안 안보여주던 입/출력들을 보여준다.

참고: Recovering from Ctrl-S in putty

2008-05-09: screen 세션에서는 XON은 ctrl-a q이다.

happy hackin'
방금 KLDP에 Debian Binary Package Building HOWTO 한글 번역을 올렸다.

happy hackin'

/etc/motd 파일

tips & tricks/Linux/Unix 2007. 5. 2. 19:33 by manywaypark
/etc/motd 파일은 "message of the day"의 줄임말로, 로그인하는 사용자에게 표시되는 메시지이다.
잘못 건드리면 커널 업데이트 등을 하고 나서 조금 이상하게 변경되는 경우가 있는 듯하다.
평소와 다른 형식으로 표시된다면, 루트 권한으로 편집하면 된다.

참고: http://uw714doc.sco.com/en/SM_startup/sstT.etcmotd.html

happy hackin'

sudo

tips & tricks/Linux/Unix 2007. 4. 23. 15:00 by manywaypark
관리하는 서버 중에 나만 sudo가 되는 박스가 있었는데, 다른 사용자의 요청이 있어서 다른 아이디 하나를 admin group에 추가하려했다.
~ # adduser foobar admin
adduser: The group `admin' does not exist.
흠... 이게 뭐지? 이게 안된적이 있었던가?
/etc/group, /etc/passwd, /etc/sudoers 등의 파일을 확인했다.
이럴 수가 /etc/group에 admin group이 아예 없다. /etc/sudoers에는 admin group이 아니라 그냥 내 아이디를 root로 전환 할 수 있는 설정으로 되어있었다. 아마도, 오래전 admin group을 root로 전환하는 형태의 기본 설정이 나오기전의 배포판 설정이 그대로 대물림(?)된 거 같았다.

일단 새로 admin group을 만들고, 사용자를 admin group에 추가:
~ # addgroup admin
Adding group `admin' (1009)...
Done.
~ # adduser foobar admin
Adding user `foobar' to group `admin'...
Done.

admin group의 root 전환을 위해 /etc/sudoers 파일에 다음 내용을 추가했다.
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

happy hackin'
초기화 파일을 응용하여 명령행에서 유닉스 스크립트처럼 lisp 파일을 실행하는 법에 대해 간단히 기술한다.

초기화 파일 위치:
  1. 시스템 수준: 기본값은 SBCL_HOME/sbclrc, 없으면, /etc/sbclrc이다. 명령행에서 --sysinit로 지정가능.
  2. 사용자 수준: 기본값은 HOME/.sbclrc이지만 명령행에서 --userinit로 지정가능.
상기 초기화 파일 중에 적절한 것을 선택해서 다음의 내용을 추가한다. 파일이 없으면 만든다.

shebang(#!) 형태의 lisp 프로그램 실행을 위한 초기화 파일 내용:
;;; If the first user-processable command-line argument is a filename,
;;; disable the debugger, load the file handling shebang-line and quit.
(let ((script (and (second *posix-argv*)
(probe-file (second *posix-argv*)))))
(when script
;; Handle shebang-line
(set-dispatch-macro-character #\# #\!
(lambda (stream char arg)
(declare (ignore char arg))
(read-line stream)))
;; Disable debugger
(setf *invoke-debugger-hook*
(lambda (condition hook)
(declare (ignore hook))
;; Uncomment to get backtraces on errors
;; (sb-debug:backtrace 20)
(format *error-output* "Error: ~A~%" condition)
(quit)))
(load script)
(quit)))

test program(hello.lisp):
#!/usr/bin/sbcl --noinform
(write-line "Hello, World!")

실행:
$ chmod +x hello.lisp
$ ./hello.lisp
Hello, World!
$ sbcl hello.lisp
This is SBCL 0.9.14, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
Hello, World!

참고: http://www.sbcl.org/manual/Initialization-Files.html

2007-10-24
cl-launch를 사용하면 sbcl을 포함한 다른 CL implementation에서도 쓸 수 있는 좀 더 일반적인 방법으로 common lisp 프로그램을 명령행에서 실행할 수 있다.

happy hackin'

update-alternatives

tips & tricks/Linux/Unix 2007. 3. 3. 18:32 by manywaypark
update-alternatives를 사용하면 기본 명령어의 symbolic link들을 손쉽게 관리할 수 있다. 기본 설정을 변경하지 않았다면, /etc/alternatives에 있는 symbolic link들을 사용할 것이다.
기본 편집기를 변경하는 예를 들어 간단히 설명하겠다.
~$ ls -xalh /etc/alternatives/editor
lrwxrwxrwx 1 root root 23 2007-03-02 14:28 /etc/alternatives/editor -> /bin/nano

~$ update-alternatives --list editor
/usr/bin/vim.tiny
/bin/ed
/bin/nano
/usr/bin/emacs-snapshot

~$ sudo update-alternatives --config editor

There are 4 alternatives which provide `editor'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/vim.tiny
2 /bin/ed
*+ 3 /bin/nano
4 /usr/bin/emacs-snapshot

Press enter to keep the default[*], or type selection number: 4
Using `/usr/bin/emacs-snapshot' to provide `editor'.

~$ ls -xalh /etc/alternatives/editor
lrwxrwxrwx 1 root root 23 2007-03-03 18:02 /etc/alternatives/editor -> /usr/bin/emacs-snapshot

이제부터는 명령행에서 editor를 실행하면, 예전의 nano대신 emacs가 실행될 것이다.
(*는 현재 선택된 것을, +는 기본 값을 나타낸다.)

기본 편집기를 변경한다는 것의 의미는 각종 응용프로그램이 사용자 편집을 받을 경우에 기본편집기를 사용하게 된다는 것이다.
ex) svn commit 메시지 입력, crontab -e에서의 예약작업 편집 등.

happy hackin'

1 
분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

04-25 16:52