Skip to content

Instantly share code, notes, and snippets.

@zeta709
zeta709 / Makefile
Created August 12, 2013 04:33
Makefile for c and cpp.
# Run 'make -p' to see make's default variables
#COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
#LINK.o = $(CC) $(LDFLAGS) $(TARGET_ARCH)
CFLAGS = -std=c99 -Wall -Wextra -O2
LDLIBS =
TARGET = main
SRCS = main.c mylib.c
OBJS = $(SRCS:.c=.o)
@zeta709
zeta709 / time.c
Last active December 20, 2015 22:49
Measuring execution time of a function.
#include <stdio.h>
volatile int tmp;
static const int N = 123456789;
/* Linux method #0: use gettimeofday() (obsolete?)
*/
#include <sys/time.h>
// timeradd, timersub, etc. macros are _BSD_SOURCE.
// Those will be defined only if the symbol __USE_BSD is defined.
@zeta709
zeta709 / hello.py
Last active December 21, 2015 00:29
TEST
#!/usr/bin/env python
print('Hello, World!')
@zeta709
zeta709 / !solarized-256.md
Last active December 21, 2015 02:09
solarized (w/o changing terminal colors)

Terminal 설정을 최대한 바꾸지 않고 vim에서 solarized 쓰는 방법. 참고

  • .vimrc에 "let g:solarized_termcolors=256"를 추가해야 한다.
  • .bashrc, .tmux.conf 등을 수정하여 xterm-256color, screen-256color 등을 사용하게 만들어야 하며, 이렇게 하지 않고 solarized를 사용하면 흑백(gray 없이 black/white)으로 나온다.
@zeta709
zeta709 / !solarized-16.md
Last active December 21, 2015 02:09
solarized (with changing terminal colors)

Terminal 설정을 바꾼 후 vim에서 solarized 쓰는 방법. 참고

  • 이 방법을 쓰려면 terminal 색상을 반드시 적절히 바꾸어야 한다. 바꾸는 방법은 terminal 마다 다른데, 보통 검색해보면 방법이 있다. 참고로 강조 문자에는 강조 색을 사용하도록 설정해야 한다.
  • 아마도 .vimrc에 "let g:solarized_termtrans=1"가 필요할 것이다.
  • .bashrc 등은 수정할 필요가 없다.
  • 이 방법은 terminal의 16색을 완전히 다른 색에 mapping하는 방법이다. 그렇기 때문에 이 방법을 쓰면 dir의 색상 등이 제대로 보이지 않을 수도 있다.
@zeta709
zeta709 / .muttrc
Created August 14, 2013 18:14
Mutt
# Mutt & Maildir Mini-HOWTO
# http://www.elho.net/mutt/maildir/
set mbox_type=Maildir
set folder="~/Maildir/"
set mask="!^\\.[^.]"
set record=".Sent"
set postponed=".Drafts"
set spoolfile="~/Maildir/"
mailboxes `echo -n "+ "; find ~/Maildir -maxdepth 1 -type d -name ".*" -printf "+'%f' "`
macro index c "<change-folder>?<toggle-mailboxes>" "open a different folder"
@zeta709
zeta709 / 00-llvm.md
Last active December 21, 2015 12:49
funtoo: Falied to emerge sys-devel/llvm-3.3-r1

문제: gcc-4.6.4를 쓰면 llvm을 emerge할 수 없다.

gcc-4.6.4.ebuild를 살펴보면 gcc-4.6.3.ebuild와 많이 다르다. 특히 "STDCXX_INCDIR" 등의 항목이 있는데, 확실한 것은 아니지만 이것 때문에 header file이 이상한 곳에 설치되는 것 같다. 로그를 보면 algorithm을 찾을 수 없다고 나오는데 다음과 같이 include path를 두 개 추가해서 컴파일하면 컴파일이 된다.

/var/tmp/portage/sys-devel/llvm-3.3-r1/work/llvm-3.3.src-amd64/Release/bin/clang -fno-exceptions -fPIC -funwind-tables -I/var/tmp/portage/sys-devel/llvm-3.3-r1/work/llvm-3.3.src/projects/compiler-rt/lib -I/var/tmp/portage/sys-devel/llvm-3.3-r1/work/llvm-3.3.src/projects/compiler-rt/include -Wall -Werror -O3 -fomit-frame-pointer -m64 -fPIE -fno-builtin -fno-rtti -c -o /var/tmp/portage/sys-devel/llvm-3.3-r1/work/llvm-3.3.src-amd64/tools/clang/runtime/compiler-rt/clang_linux/msan-x86_64/x86_64/SubDir.lib__msan/msan_linux.o /var/tmp/portage/sys-devel/llvm-3.3-r1/work/llvm-3.3.src/projects/compiler-rt/lib/msan/msan_linux.cc -I/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.4/include/g++-v4.6 -I/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.4/include/g++-v4.6/x86_64-pc-linux-gnu

@zeta709
zeta709 / krdc.md
Created August 23, 2013 08:32
krdc 4.11 + freerdp-1.1.0_beta1_p20130710

krdc 4.11 + freerdp-1.1.0_beta1_p20130710 조합에서 krdc를 사용할 수 없었다. 접속을 시도했을 때 파란 화면만 나오고 아무런 반응이 없었다.

원인을 알아보니 암호를 묻는 prompt가 gui에 나타나지 않고 command line에 나타나는 것이 문제였다. 그리고 freerdp의 경우 -u 옵션으로 사용자를 지정해주어야 한다. 이 옵션이 없을 경우 username으로 무엇을 사용하는지 잘 모르겠다. 리눅스 사용자 이름을 쓰는 것은 아닌 것 같은데, 이렇게 생각하는 이유는 리눅스 사용자 이름과 접속하려는 서버의 사용자 이름이 동일한데도 이 옵션 없이 암호만 입력하면 로그인이 되지 않았기 때문이다.

참고: KDE Bug 322361

@zeta709
zeta709 / 00-short-tips.md
Last active December 21, 2015 14:49
short tips; delete a newline at end of file; pygmentize; random password generator

작은 팁 모음

  • gist 설명 부분에 내용을 적어야 빠른 검색이 된다.