728x90
728x90
728x90

d

728x90
728x90

Python 3.8부터는 Walrus Operator라는 기능을 제공한다.

이는 assignment operation인데 다음과 같은 상황에서, one line을 생략할 수 있다.

 

 

 

Before)

n=max([1,2,3])

if n > 5:

  print("SUCCESS")

else:

  print("FAIL")

 

After)

if (n := max([1,2,3]) > 5:

  print("SUCCESS")

else:

  print("FAILE")

print(n)  # 3

 

즉, 어떠한 값을 assign과 condition판단을 동시에 해야하는 경우, line reduction효과를 얻을 수 있다.

 

728x90
728x90

clustered index

B-Tree

InnoDB

page

page split

secondry index

 

728x90

'CS' 카테고리의 다른 글

[Algorithm]the shortest repetitive pattern in a string  (0) 2020.11.14
[Python] Walrus Operator  (0) 2020.11.14
(미완)[Ubuntu]명령어 test모음  (0) 2020.11.12
[Ubuntu]command mv  (0) 2020.11.12
[Ubuntu]command cd  (0) 2020.11.12
728x90

자주 쓴 것

자주 쓸 것 같은데 귀찮아서 안알아 본 상황과 그 때의 해결책들을 적어나가자.

 

nvidia-smi을 0.5초마다 갱신하게 출력하라

watch -n 0.5 nvidia-smi

 

현재 directory에 file1과 file2가 있다.

file1, file2에 space단위로 나눈 word가 총 몇번 등장하는지를 write to output.txt

cat file1 file2 | tr ' ' '\n' | sort | uniq -c > output.txt

 

home directory에 file과 dir 총 개수를 반환하여라.

ls ~ | wc -l

 

dir에 있는 file 개수만 반환하여라.

find dir -maxdepth 1 -type f | wc -l

 

dir에 있는 .c로 끝나는 파일 개수만 반환하여라.

find dir -maxdepth 1 -name "*.c" | wc -l

 

dir에 있는 checkpoint로 시작하는 directory 개수만 반환하여라.

find dir -maxdepth 1 -name "checkpoint*" -type d | wc -l

 

file의 상단 5줄을 출력하여라.

head -n 5 file

 

file의 하단 5줄을 출력하여라.

tail -n 5 file

 

현재 directory에서 하위 폴더 까지, def func이란 pattern을 포함하는 파일(위치+파일명)과 pattern이 등장한 line수를 함께 출력하여라.

grep -rn "def func"

 

lib폴더 내에 .py로 끝나는 파일 중 opt란 pattern을 포함하는 파일의 개수를 반환하여라. (중복조심, 한 파일에 여러개 등장시 1개파일로 간주하고 count)

grep -l -d skip 'opt' lib/* | wc -l  # grep의 -l은 matched file만 출력, -d skip은 lib내 directory는 무시(-d skip이 없고 lib 내에 dir가 존재하면, lib/dir Is a directory란 line을 출력함)

 

file1 내에 알파벳과 공백이 아닌 모든 것을 지워 file2로 작성하여라.

cat file1 | tr -cd [a-zA-Z][:space:] > file2

 

728x90

'CS' 카테고리의 다른 글

[Python] Walrus Operator  (0) 2020.11.14
Index, Multi-index 이해하기  (0) 2020.11.12
[Ubuntu]command mv  (0) 2020.11.12
[Ubuntu]command cd  (0) 2020.11.12
[Ubuntu]redirection  (0) 2020.11.12
728x90

mv는 move files

 

mv file1 file2  # file1을 file2로 rename

mv dir/* .  # dir내 모든 파일을 현재 directory로 이동

mv dir1/* dir2  # dir1내 모든 파일을 dir2로 이동

mv file1 file2 dir1 dir2  # file1, file2, dir1을 dir2내로 이동

 

mv는 last argument가 destination

 

728x90

'CS' 카테고리의 다른 글

Index, Multi-index 이해하기  (0) 2020.11.12
(미완)[Ubuntu]명령어 test모음  (0) 2020.11.12
[Ubuntu]command cd  (0) 2020.11.12
[Ubuntu]redirection  (0) 2020.11.12
[Ubuntu]command man과 info  (0) 2020.11.12
728x90

cd는 change directory

 

cd  # home directory로 이동

cd ~  # home directory로 이동

cd ~/dir  # home/dir로 이동

cd /  # root directory로 이동

cd ../dir  # parent/dir로 이동

cd -  # 직전 directory로 이동(parent랑 다름)

 

cd는 argument가 없거나 1개만 가능

 

 

728x90

'CS' 카테고리의 다른 글

(미완)[Ubuntu]명령어 test모음  (0) 2020.11.12
[Ubuntu]command mv  (0) 2020.11.12
[Ubuntu]redirection  (0) 2020.11.12
[Ubuntu]command man과 info  (0) 2020.11.12
[Ubuntu]command tr  (0) 2020.11.12
728x90

standard output을 다음 명령어로 넘기려면 |을 사용

standard output을 write to file하려면 >

standard output을 append to file하려면 >>

 

참고자료:

ubuntu.com/tutorials/command-line-for-beginners#4-creating-folders-and-files

 

The Linux command line for beginner | Ubuntu

Ubuntu is an open source software operating system that runs from the desktop, to the cloud, to all your internet connected things.

ubuntu.com

 

728x90

'CS' 카테고리의 다른 글

[Ubuntu]command mv  (0) 2020.11.12
[Ubuntu]command cd  (0) 2020.11.12
[Ubuntu]command man과 info  (0) 2020.11.12
[Ubuntu]command tr  (0) 2020.11.12
[Pandas]dataframe에서 특정 column값 기준으로 상위 rows 선별  (0) 2020.11.10
728x90

# 가장 기본, info(=information)과 man(=manual)

info  # command 설명서, arrows key로 command가서 enter치면 해당 command information조회

info command  # 특정 command의 information조회

man command  # 특정 comman의 manual을 조회, 

(info는 default format for cocumentation inside the GNU project, Texinfo를 source format으로 사용하여 good-looking printed version이나 PDF로 변환이 쉬움, combined manuals로 like a book임)

(man은 the much older traditional format for UNIX, specific topic 정보 전달에 가까움)

(즉, specific하게는 man사용, 전체적으로 보려면 info사용)

 

참고자료:

askubuntu.com/questions/9325/what-is-the-difference-between-man-and-info-documentation

 

What is the difference between "man" and "info" documentation?

Regarding man-pages and info help documentation: Why do two such similar sources of documentation exist? Sometimes a man-page is available and the info is not; or vice-versa. I haven't yet latch...

askubuntu.com

 

728x90

'CS' 카테고리의 다른 글

[Ubuntu]command cd  (0) 2020.11.12
[Ubuntu]redirection  (0) 2020.11.12
[Ubuntu]command tr  (0) 2020.11.12
[Pandas]dataframe에서 특정 column값 기준으로 상위 rows 선별  (0) 2020.11.10
[Pandas]dataframe의 row를 shuffle하기  (0) 2020.11.10
728x90

tr  # translate, squeeze, and/or delete characters from standard input, writing to standard output.

 

echo "My UID is $UID" | tr ' ' '\n'  # space단위 word를 line마다 출력(왜냐하면 space를 new line으로 translate

echo "id pwd" | tr ' ' ':'  # space를 :로 translate

echo "abc" | tr [:lower:] [:upper:]  # 모든 lowercase를 uppercase로 translate

echo 'abc' | tr [a-z] [A-Z]  # 위와 같은 결과

echo 'a b c' | tr -d ' '  # -d는 delete, SET delete, 예를 들면 현재는 file 내 space를 모두 제거

echo 'a  bc' | tr -s ' '  # -s는 squeeze, SET이 연속적으로 나오면 1개로 squeeze

echo 'My UID is $UID" | tr -cd "[:digit:]\n"  # -c는 SET의 complement를 적용, 즉  $UID와 줄바꿈을 제외하곤 모두 삭제($UID는 userid로 정수값 가짐)

 

728x90
728x90

NRS(Newspaper Recommender Systems)에서의 challenge
-timeliness, 뉴스의 short duration, recency, popularity, trends and 실시간 다량 새 뉴스 유입
-long-term/short-term user preference의 급격하거나 점진적인 변화
-user의 news소비에는 일련의 sequence가 있다.
-false news and propaganda 문제가 최근 uprising challenge

NRS에서의 Recsys평가
-accuracy기반의 평가는 filter bubble문제를 야기함
-exposure to different viewpoint, perceived system effectiveness 등을 위해 beyond-accuracy metric 필요

NRS에서의 기본 challenge에서 더 나아간 new challenges
-content quality
-effects of recommendations on user behavior.

 

NEWS domain의 특징:
Average consumption time(한 뉴스당 필요한 reading 시간, 대개 article길이마다 다르겠지만 짧은편)
Life-span of news items(짧다, 몇분, 몇시간, 며칠 수준, release와 user review사이 시간차가 짧음)
Catelog size of news items(매우 크다, catalog 변화 속도 자체도 빠름, 시간당 수천개 기사가 쏟아지니)

 

참고자료:

https://arxiv.org/abs/2009.04964

 

A survey on news recommender system -- Dealing with timeliness, dynamic user interest and content quality, and effects of recomm

Nowadays, more and more news readers tend to read news online where they have access to millions of news articles from multiple sources. In order to help users to find the right and relevant content, news recommender systems (NRS) are developed to relieve

arxiv.org

 

 

728x90

+ Recent posts