$ tree --help
usage: tree [-acdfghilnpqrstuvxACDFJQNSUX] [-H baseHREF] [-T title ]
[-L level [-R]] [-P pattern] [-I pattern] [-o filename] [--version]
[--help] [--inodes] [--device] [--noreport] [--nolinks] [--dirsfirst]
[--charset charset] [--filelimit[=]#] [--si] [--timefmt[=]<f>]
[--sort[=]<name>] [--matchdirs] [--ignore-case] [--fromfile] [--]
[<directory list>]
------- Listing options -------
-a All files are listed.
-d List directories only.
-l Follow symbolic links like directories.
-f Print the full path prefix for each file.
-x Stay on current filesystem only.
-L level Descend only level directories deep.
-R Rerun tree when max dir level reached.
-P pattern List only those files that match the pattern given.
-I pattern Do not list files that match the given pattern.
--ignore-case Ignore case when pattern matching.
--matchdirs Include directory names in -P pattern matching.
--noreport Turn off file/directory count at end of tree listing.
--charset X Use charset X for terminal/HTML and indentation line output.
--filelimit # Do not descend dirs with more than # files in them.
--timefmt <f> Print and format time according to the format <f>.
-o filename Output to file instead of stdout.
------- File options -------
-q Print non-printable characters as '?'.
-N Print non-printable characters as is.
-Q Quote filenames with double quotes.
-p Print the protections for each file.
-u Displays file owner or UID number.
-g Displays file group owner or GID number.
-s Print the size in bytes of each file.
-h Print the size in a more human readable way.
--si Like -h, but use in SI units (powers of 1000).
-D Print the date of last modification or (-c) status change.
-F Appends '/', '=', '*', '@', '|' or '>' as per ls -F.
--inodes Print inode number of each file.
--device Print device ID number to which each file belongs.
------- Sorting options -------
-v Sort files alphanumerically by version.
-t Sort files by last modification time.
-c Sort files by last status change time.
-U Leave files unsorted.
-r Reverse the order of the sort.
--dirsfirst List directories before files (-U disables).
--sort X Select sort: name,version,size,mtime,ctime.
------- Graphics options -------
-i Don't print indentation lines.
-A Print ANSI lines graphic indentation lines.
-S Print with CP437 (console) graphics indentation lines.
-n Turn colorization off always (-C overrides).
-C Turn colorization on always.
------- XML/HTML/JSON options -------
-X Prints out an XML representation of the tree.
-J Prints out an JSON representation of the tree.
-H baseHREF Prints out HTML format with baseHREF as top directory.
-T string Replace the default HTML title and H1 header with string.
--nolinks Turn off hyperlinks in HTML output.
------- Input options -------
--fromfile Reads paths from files (.=stdin)
------- Miscellaneous options -------
--version Print version and exit.
--help Print usage and this help message and exit.
-- Options processing terminator.
$ sed --help
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...
-n, --quiet, --silent
suppress automatic printing of pattern space
--debug
annotate program execution
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
--follow-symlinks
follow symlinks when processing in place
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if SUFFIX supplied)
-b, --binary
open files in binary mode (CR+LFs are not processed specially)
-l N, --line-length=N
specify the desired line-wrap length for the `l' command
--posix
disable all GNU extensions.
-E, -r, --regexp-extended
use extended regular expressions in the script
(for portability use POSIX -E).
-s, --separate
consider files as separate rather than as a single,
continuous long stream.
--sandbox
operate in sandbox mode (disable e/r/w commands).
-u, --unbuffered
load minimal amounts of data from the input files and flush
the output buffers more often
-z, --null-data
separate lines by NUL characters
--help display this help and exit
--version output version information and exit
If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret. All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.
GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-sed@gnu.org>.
use test_<suffix>;
create table tbl_test
(
);
위와 같은 create script 에서 <suffix> 만 바꿔서 돌리고 싶은 경우가 있다.
$ sed "s/<suffix>/01/g" test.txt
use test_01;
create table tbl_test
(
);
s/[기존 문자열]/[변경 후 문자열]/g 를 입력하면 test.txt 를 읽어 [기존 문자열] 을 [변경 후 문자열] 로 바꾸어 출력해 준다.
$ sed "s/<suffix>/01/g" -i test.txt
$ cat test.txt
use test_01;
create table tbl_test
(
);
-i 파라미터를 사용하면 입력 파일을 바로 바꾼다.
$ sed "s/<suffix>/01/g" -i.bak test.txt
$ ls test*
test.bat test.txt test.txt.bak
$ wc --help
Usage: wc [OPTION]... [FILE]...
or: wc [OPTION]... --files0-from=F
Print newline, word, and byte counts for each FILE, and a total line if
more than one FILE is specified. A word is a non-zero-length sequence of
characters delimited by white space.
With no FILE, or when FILE is -, read standard input.
The options below may be used to select which counts are printed, always in
the following order: newline, word, character, byte, maximum line length.
-c, --bytes print the byte counts
-m, --chars print the character counts
-l, --lines print the newline counts
--files0-from=F read input from the files specified by
NUL-terminated names in file F;
If F is - then read names from standard input
-L, --max-line-length print the maximum display width
-w, --words print the word counts
--help display this help and exit
--version output version information and exit
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
Full documentation <https://www.gnu.org/software/coreutils/wc>
or available locally via: info '(coreutils) wc invocation'
$ wc -l test.txt
1 test.txt
위와 같이 -l, --lines 옵션을 사용하면 된다.
$ cat test.txt
ab cd
aa
$ wc -l test.txt
1 test.txt
mssql 쓸 때는 ssms(sql server management studio) 라는 툴만 사용해서 몰랐는데 mysql 에 console 로 작업하려니 죽을 맛이다. 물런 mysql 도 workbench 나 유료 툴인 sqlyog 이 있지만 서버 장비에 작업 pc 로 vpn 이용하더라도 접근할 수 없다. :(
시간이 오래 걸리는 쿼리를 돌렸는데 mysql 프로세스는 열일 중이었지만 어떤 상태인지 궁금했다. mysql process 상태를 볼 때는 show processlist 를 사용한다.
mysql> show processlist;
+----+------+----------------+------+---------+------+----------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+----------------+------+---------+------+----------+------------------+
| 7 | root | localhost:6576 | NULL | Sleep | 122 | | NULL |
| 8 | root | localhost:6577 | NULL | Sleep | 122 | | NULL |
| 9 | root | localhost:7356 | NULL | Query | 0 | starting | show processlist |
+----+------+----------------+------+---------+------+----------+------------------+
3 rows in set (0.00 sec)
쿼리를 실행하면 State 와 Info 를 통해 상태를 확인할 수 있다. 여러 줄의 쿼리일 경우 Info 에 실행중인 쿼리가 표시된다.
윈도우즈 10 부터 wsl 이라고 linux 를 윈도우즈에서 가상머신으로 실행할 수 있게 되었다.
$ cat /etc/resolv.conf # This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf: # [network] # generateResolvConf = false nameserver 172.26.0.1
wsl 내에서 host 윈도우즈의 mysql 과 같은 서비스에 접근하려면 host os 의 ip 를 알아야 하는데 고정된 ip 가 아니다. host 윈도우즈의 ipconfig 명령에서 WSL 목록이나 etc/resolv.conf 의 nameserver 항목을 통해 ip를 확인할 수 있다.
fatal error C1128: 섹션 수가 개체 파일 형식 한도를 초과했습니다. /bigobj를 사용하여 컴파일하십시오.
여러 파일을 묶어서 빌드하다 보면 C1128 오류가 발생할 수 있다. 구성 속성 > C/C++ > 명령줄에 /bigobj 를 추가하자.
메모리 관련 문제가 발생할 수도 있는데 구성 속성 > 고급 > 기본 설정 빌드 도구 아키텍처를 64비트(x64) 로 바꿔보자.
Unity 빌드를 설정하고 빌드할 경우 예상치 못한 컴파일 오류를 발견할 수 있다. pragma once 누락된 경우는 추가하면 되고 struct 를 class 로 전방 선언을 잘못한 경우는 맞춰주면 된다.
수정하기 힘들 경우 개별 파일을 Unity Build 에서 제외하자. 개별 파일 속성에서 C/C++ > Unity 빌드 > Unity 파일에 포함을 통해 제외 설정을 할 수 있다.
예를 들어 다음과 같은 경우 컴파일 오류가 있을 수 있다. - 미리 컴파일된 헤더를 사용하는 파일과 사용하지 않는 파일이 같이 묶인 경우 - include 된 파일에 namespace 나 struct/class 이름, OPTION, DEBUG, CONFIG 와 같은 define 과 enum 들이 재정의 된 경우 - file scope static 변수가 겹치는 경우
Unity 빌드를 적용하면 파일이 많은 프로젝트 같은 경우 25% ~ 50% 정도 빌드 시간이 줄어드는 것 같다.
Unity 빌드를 적용하면 Include 누락을 조심해야 한다. 다른 파일에 include 되어 자신의 개발 환경이나 커밋한 시점에는 빌드에 문제가 없을 수 있지만 다른 사람이 커밋할 경우 Unity 빌드 파일 구성이 변경되어 include 오류가 발생할 수 있다. Unity 빌드를 사용하지 않는 다른 빌드 환경에서는 바로 문제가 발생한다. ReSharper 와 같은 툴의 도움을 받을 수도 있지만 작업 파일을 수시로 개별 컴파일(Ctrl+F7) 해서 실수를 줄일 수 있다.
참고로 Unreal Build Tool 의 경우 Adaptive Unity Build 라고 자체적으로 만든 기능이 있다. git 이나 perforce 으로 수정 중인 파일(checkout) 은 Unity Build 에서 빼서 컴파일 해준다. 수정 중인 파일을 unity 에서 분리해서 컴파일 시간을 줄여주는 효과만 생각했었는데 이런 include 오류를 잡아주는 효과도 큰 것 같다.
P.S. (2022-04-30) #pragma warning(disable:nnnn) 같은 선언이 다른 파일에 영향을 줄 수 있으니 #pragma warning(push) - #pragma warning(pop) 으로 잘 묶어서 사용하자.
--cherry-pick 이나 --left-only, --right-only 의 의미는 아래와 같다.
--cherry-pick Omit any commit that introduces the same change as another commit on the “other side” when the set of commits are limited with symmetric difference.For example, if you have two branches, A and B, a usual way to list all commits on only one side of them is with --left-right (see the example below in the description of the --left-right option). However, it shows the commits that were cherry-picked from the other branch (for example, “3rd on b” may be cherry-picked from branch A). With this option, such pairs of commits are excluded from the output. --left-only --right-only List only commits on the respective side of a symmetric difference, i.e. only those which would be marked < resp. > by --left-right.For example, --cherry-pick --right-only A...B omits those commits from B which are in A or are patch-equivalent to a commit in A. In other words, this lists the + commits from git cherry A B. More precisely, --cherry-pick --right-only --no-merges gives the exact list.
--committer= 를 이용해서 자신의 커밋들로 필터할 수도 있다.
--committer=<pattern> Limit the commits output to ones with author/committer header lines that match the specified pattern (regular expression). With more than one --author=<pattern>, commits whose author matches any of the given patterns are chosen (similarly for multiple --committer=<pattern>).
2 에서 branch 한 branch1은 4 - 5 를 commit 했다. 4 를 cherry-pick 할 때 conflict 이 발생해서 수정해서 commit 한 상황이다. 이 경우에는 별개의 commit 으로 취급되는 것 같다.