[컴] IntelliJ breakpoint 의 suspend

jetbrain 브레이크 포인트 / breakpoints / break point / 인텔리제이 / intellij break / suspend / 방법 /

IntelliJ breakpoint

Suspend

  • All : breakpoint 에 thread 가 걸리면, 모든 thread 가 suspend 된다.
  • Thread : breakpoint 에 thread 가 걸리면, 그 thread 만 멈추고(suspend) 나머지는 그냥 동작한다.

Reference

  1. Breakpoints | IntelliJ IDEA

[컴][swe] 프로그래밍 가이드 라인

 

프로그래밍 가이드 라인

Zen of python 의 내용은 프로그래밍을 하는 사람에게 유용한 정보라고 생각된다. 특히나 여럿이 해야 하는 대단위 프로젝트에서는 더더욱 중요하다고 생각한다. 그래서 정리를 좀 해본다.

Zen Of Python

Zen Of Python

컴퓨터 프로그래밍 할 때의 가이드라인 같은 것들이 있는데, 그중에 python 을 만들때 영향을 준 가이드라인이라고 한다. 총 19개이다.

이것을 Tim Peter 라는 사람이 1999년 python mailing list 에 올렸다고 한다.

  1. Beautiful is better than ugly. : 아름다운것이 못생긴것보다 낫다.
  2. Explicit is better than implicit. : 명확한 것이 내포된 것 보다 낫다.
  3. Simple is better than complex. : 간단한 것이 복잡한 것 보다 낫다.
  4. Complex is better than complicated. : 구조적으로 복잡한 것이 이해못할정도의 복잡함 보다는 낫다
  5. Flat is better than nested. : 편편한 것이 중첩된 것 보다 낫다.
  6. Sparse is better than dense. : 드문것이 촘촘한 것 보다 낫다.
  7. Readability counts. : 가독성은 중요하다.
  8. Special cases aren't special enough to break the rules. : 특별한 경우들 때문에 규칙을 깨지마라.
  9. Although practicality beats purity. : 실용성이 순수함을 이긴다하더라도 규칙을 깨지마라.
  10. Errors should never pass silently. : 에러들은 절대 조용히 발생하면 안된다.
  11. Unless explicitly silenced. : 명확히 조용하지 않는한, 에러는 조용히 발생하면 안된다.
  12. In the face of ambiguity, refuse the temptation to guess. : 모호한 것이 있을 때, 추측으로 그것을 넘겨짚지 마라.
  13. There should be one– and preferably only one –obvious way to do it. : 그것을 하는 방법이 1개는 있어야만 한다. 가급적이면, 하나만 있어야 한다.
  14. Although that way may not be obvious at first unless you're Dutch. : 만약 당신이 네델란드인이 아니라서, 비록 그것이 처음에는 명확치 않을 수 있을지라도,
  15. Now is better than never. : 이후에 안하는 것보다 지금이 하는 것이 낫다.
  16. Although never is often better than right now. : “전혀 안하는 것”이 종종 “바로지금” 보다 나을지라도, 이후에 안하는 것보다 지금하는 것이 낫다.
  17. If the implementation is hard to explain, it's a bad idea. : 만약 구현을 설명하기 힘들다면, 그것은 나쁜 아이디어다.
  18. If the implementation is easy to explain, it may be a good idea. : 만약에 구현이 설명하기 쉽다면, 그것은 좋은 아이디어다.
  19. Namespaces are one honking great idea – let's do more of those! : 네임스페이스들은 경종을 울리는 좋은 아이디어이다.

See Also

  1. complex vs complicated : complex 는 구조적으로 복잡한것, complicated 는 이해가 안되는 복잡함.

Reference

  1. Wikipedia, Zen Of Python

[컴] TypeScript 에서 object type

 

TypeScript 에서 object type

TypesScript 에서 object Type 은 primitive 를 배제한 type 을 이야기 한다. 그래서 generic parameter 로 <P extends object> 를 사용했는데, primitive 를 paramter 로 넘기면, error 가 발생한다.

TypeScript 에서 Object type 도 있는데, 이녀석은 null, undefined 를 제외한 모든 녀석을 포함한다. 그런데 이 type 은 사용하지 말라고 한다.

다음글에서는 {}unknown 의 차이를 알려준다.

any 는 모든 것을 포함한다. 여기에는 unknown 도 받을 수 있고, never 도 받을 수 있고, 다 가능하다.

Reference

  1. Typescript generics - is “extends object” pointless? What is the best practice? - Stack Overflow

[컴] history 에 날짜 시간 값 넣는 방법

 

keyword: history date / linux history command / how to add date to the history / 히스토리에 date 넣는법 / 날짜 시간 넣는법 / 어떻게 넣지 / how to add date to the history

history 에 날짜 시간 값 넣는 방법

~/.bashrc 또는 /etc/bash.bashrc 에 아래의 변수를 추가하면 된다.

HISTTIMEFORMAT="%F %T: "

Reference

  1. bash - HISTTIMEFORMAT syntax - Unix & Linux Stack Exchange
  2. HISTTIMEFORMAT variable in Linux with Example - GeeksforGeeks

[컴] nodejs 에서 markdown 을 html 로 변경하기

 

markdown to html libraries / how to / 어떻게 / 변경

nodejs 에서 markdown 을 html 로 변경하기

다음 중 가장 star 가 많은 것을 사용했다.

npm i marked --save
npm i @types/marked --save-dev

Marked Documentation 에서 사용법을 확인할 수 있다.

아래처럼 사용하면 된다.

import { marked } from 'marked';

const html = marked.parse('# Marked in Node.js\n\nRendered by **marked**.');

References

  1. GitHub - markdown-it/markdown-it: Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed

[컴] ocktokit.js 를 이용해서 github issue 가져오기

github issue 가져오기 / fetching / download / crawling / crawl / 이슈

ocktokit.js 를 이용해서 github issue 가져오기

간략한 절차

  1. Personal Access Token(PAT) 만들기
  2. octokit.js 를 이용해서 issue 가져오기

예시

아래 간략한 code 가 있다. auth 를 하고, issue #10 을 가져오는 code 이다.

import { Octokit, App } from "octokit";


(async () => {


    // Create a personal access token at https://github.com/settings/tokens/new?scopes=repo
    const octokit = new Octokit({ auth: `my-personal-access-token` });

    // Compare: https://docs.github.com/en/rest/reference/users#get-the-authenticated-user
    const {data: {login}} = await octokit.rest.users.getAuthenticated();
    
    // --------------------------------------------
    // 모든 이슈를 가져올때
    const iterator = octokit.paginate.iterator(octokit.rest.issues.listForRepo, {
        owner: login,
        repo: "my_repo",
        per_page: 100,
        state: "all",
    });

    // iterate through each response
    // iterate through each response
    for await (const { data: issues } of iterator) {
        for (const issue of issues) {
            console.log("Issue #%d: %s", issue.number, issue.title);
            console.log("Issue Body: %s", issue.body);
            // comments
            const {data: commentsList} = await octokit.rest.issues.listComments({
                owner: login,
                repo: "my_repo",
                issue_number: issue.number,
            })
            for (const comment of commentsList) {
                console.log(`url=${comment.html_url}`)
                console.log(`created_at:${comment.created_at}, updated_at:${comment.updated_at}`)
                console.log(`body=${comment.body}`)
            }
        }
    }

    // --------------------------------------------
    // 특정 이슈를 가져올 때
    // gh api repos/mygitid/my_repo/issues/10
    console.log("Hello, %s", login);
    octokit.rest.users.getAuthenticated();
    const resp = await octokit.rest.issues.get({
        owner: login,
        repo: "my_repo",
        issue_number: 10,
    })
    console.log(`issue body=${resp.data.body}`)
})()

See Also

  1. 쿠…sal: [컴] github CLI 를 이용해서 Github REST API 사용

[컴] python linux wheel platform tag, manylinux

whl / linux 패키지 tag / manylinux / manlinux2014 /리눅스 패키지 / 휠 패키지 이름 / 네이밍 / naming

python linux wheel platform tag, manylinux

이 글에서는 python linux package 이름에 있는 manylinux 가 무엇을 뜻하는지 알아보려 한다.

위처럼 manylinuxYYYY 등이 보인다. 이것에 대한 설명은 다음 링크에 잘 나와 있다.

내용은 linux 의 경우 배포판(distribution) 에 따라 설치 가능여부가 달라서, 그것에 따라 많은 wheel 을 만들어야 했다. 이유는 PEP 513 에 설명되어 있는데, wheel 이 사용하는 library 들 때문이었다.

그래서 제한된 library 를 써서 되도록 많은 linux 에서 사용 가능하도록 package 의 tag 를 만들었다.

For these reasons, to achieve broad portability, Python wheels

  • should depend only on an extremely limited set of external shared libraries; and
  • should depend only on “old” symbol versions in those external shared libraries; and
  • should depend only on a widely-compatible kernel ABI.

그래서 만든것이 manylinux1 이라 한다. 그런데, 이것이 linux 가 시간이 흐르면서 새로운 library version 을 쓰게 되면서, manylinux2010, manylinux2014 까지 왔다. 그러다가 이것을 glib 의 버전에 맞춰서 표기하는 manylinux_x_y 까지 오게 됐다고 한다.

아래는, 위 글에서 가져온 표이다.

manylinux tag Client-side pip version required CPython (sources) version embedding a compatible pip Distribution default pip compatibility
manylinux_x_y pip >= 20.3 3.8.10+, 3.9.5+, 3.10.0+ ALT Linux 10+, RHEL 9+, Debian 11+, Fedora 34+, Mageia 8+, Photon OS 3.0 with updates, Ubuntu 21.04+
manylinux2014 pip >= 19.3 3.7.8+, 3.8.4+, 3.9.0+ CentOS 7 rh-python38, CentOS 8 python38, Fedora 32+, Mageia 8+, openSUSE 15.3+, Photon OS 4.0+ (3.0+ with updates), Ubuntu 20.04+
manylinux2010 pip >= 19.0 3.7.3+, 3.8.0+ ALT Linux 9+, CentOS 7 rh-python38, CentOS 8 python38, Fedora 30+, Mageia 7+, openSUSE 15.3+, Photon OS 4.0+ (3.0+ with updates), Ubuntu 20.04+
manylinux1 pip >= 8.1.0 3.5.2+, 3.6.0+ ALT Linux 8+, Amazon Linux 1+, CentOS 7+, Debian 9+, Fedora 25+, openSUSE 15.2+, Mageia 7+, Photon OS 1.0+, Ubuntu 16.04+