TWIG::2020.07.13

Today lolol·2020년 7월 13일
0

TWIG

목록 보기
5/17
post-thumbnail

- Long Day

뭔가 긴 하루였다.
긴 하루가 지나고 밤이 찾아왔다. 잘 시간이다! 😊

마음가짐에 따라 많은 것이 좌지우지된다.
기분 좋게 하루를 시작하고, 기분 좋게 하루를 마무리하자.

- git reset

https://stackoverflow.com/questions/348170/how-do-i-undo-git-add-before-commit

git add를 하고 난 이후에 추가된 내용은 git status를 통해 확인할 수 있다.
추가된 내용을 삭제하고 싶다면, git reset <file_name>을 통해 삭제할 수 있다.

각각 지우는 것이 아닌 전부 지우고 싶다면, git reset만 쓰면 된다.

- .gitignore

.gitignore파일을 생성하여, git add에서 제외될 항목을 지정할 수 있다.
어떻게 설정할지 난감하다면 아래의 사이트를 이용해보면 어떨까? 도움이 될 것 이다.


https://www.toptal.com/developers/gitignore

나의 경우, pycharm에서 사용되는 .idea폴더와 .venv폴더를 제외해야 했다.

# Created by https://www.toptal.com/developers/gitignore/api/venv
# Edit at https://www.toptal.com/developers/gitignore?templates=venv

### venv ###
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
.idea
pip-selfcheck.json

# End of https://www.toptal.com/developers/gitignore/api/venv

venv의 경우, 위 사진처럼 추가하면 되겠으나 .idea폴더는 해당 키워드 결과값이 없어서 내가 임의로 추가했다.

- CentOS root

CentOS에서 무엇이든 설치하려고 하면 안되는 경우가 있다.
일단 root로 들어가자.

https://jhnyang.tistory.com/136

sudo passwd를 입력해서, 초기 비밀번호를 설정한 다음
su - 명령으로 루트 권한으로 들어가서 yum으로 패키지를 설치할 수 있다.

- ssh key

내가 windows에서 맥을 쓰게 했던 원인이었던... ssh key에 대한 문제를 이제 어느정도 해결했다고 할 수 있겠다.

메인 아이디어는 powershell이 아닌 git bash를 쓰는 것이다.
(powershell을 고집했던 날들아... wsl은 아직 안써봤지만.... 추후에..)

비대칭 키 방식이다.
git bash에서 ssh-add를 통해서 나의 private key를 추가하고 저장소(github, gitlab ...)에는 public key를 추가한다.

하지만 git bash라고 호락호락하게 명령어가 잘통하진 않는다.
(쉽게 될줄 알았나? 어림도 없지 😈)

https://rutesun.wordpress.com/2015/02/04/git-bash-%EA%B0%9C%EC%9D%B8%ED%82%A4-%EB%93%B1%EB%A1%9D%EC%8B%9C-%EC%97%90%EB%9F%AC/

보통 사용하는 방법

#ssh-agent를 시작
$ ssh-agent -s
#개인키를 등록
$ ssh-add ~/.ssh/id_rsa

대안

#ssh-agent를 시작
$ eval $(ssh-agent)
#개인키를 등록
$ ssh-add ~/.ssh/id_rsa

참고하면 좋은 게시물

- Make python cli

https://codeburst.io/building-beautiful-command-line-interfaces-with-python-26c7e1bb54df
위 게시물에서 여러가지 라이브러리를 추천해주고 있다. 그 중에서

https://github.com/pallets/click
이 라이브러리는 꽤나 간단하게 생겼다.

# test-click.py
import click

@click.command()
@click.option("--count", default=1, help="Number of greetings.")
@click.option("--name", prompt="Your name", help="The person to greet.")
def hello(count, name):
    """Simple program that greets NAME for a total of COUNT times."""
    for _ in range(count):
        click.echo(f"Hello, {name}!")

if __name__ == '__main__':
    hello()

깃헙에 나와있는 코드를 긁어온 것인데

$ python hello.py --count=3
Your name: Click
Hello, Click!
Hello, Click!
Hello, Click!

이런 식으로 사용할 수 있다. 굉장히 간단하면서 명료해보인다.

- Splash lib

scrapinghub에 속한 프로젝트이다.
stackoverflow에서 이 라이브러리와 scrapy를 함께 쓴다는 내용을 보고 추후 필요시 참고할 예정이다.

- Selenium waits

https://www.selenium.dev/documentation/en/webdriver/waits/

  • implicitly wait
  • explicit wait
  • fluent wait

이렇게 세가지가 언급되어 있다.
내일 봐야지!

... 그럼 굿밤! 🛌

profile
working making doing makes us 🤖

0개의 댓글