$ wget https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-armv7l.tar.xz 

$ tar -xvf *.xz

node-v12.14.1-linux-armv7l.tar.xz $ sudo cp -R * /usr/local/

 

다음에 node -v와 npm -v로 설치를 확인한다.

$ sudo pip install jupyterthemes

$ jt -l #테마 리스트 보기

$ jt -t onedork -T -f 폰트이름 -fs 폰트사이즈 -tf 텍스트셀폰트 -tfs 텍스트셀폰트사이즈 -nf 노트북폰트 -nfs 노트북폰트사이즈

 

이렇게 적용하면 된다.

'Python' 카테고리의 다른 글

iteration, iterable, iterator  (0) 2019.12.27
( ) = ( ) if ( ) else ( ) 구문  (0) 2019.12.27
변수명  (0) 2019.12.27
python statements  (0) 2019.12.27
binary data pack unpack examples  (0) 2019.12.27

윈도우 우분투나 리눅스에서

$ ssh -t [user_id]@server_ip "sudo dd if=/dev/mmcblk0 | gzip -1 -" | dd of=image.gz

 

이라고 하면 현재 로컬 컴퓨터에 image.gz 파일이 생긴다.

참고
1. https://www.joinc.co.kr/w/man/12/Nginx/basicauth
2. https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/

 

다음글 참조

https://medium.com/@apbetahouse45/how-to-run-jupyter-notebooks-on-remote-server-part-1-ssh-a2be0232c533

 

How to run Jupyter Notebooks on remote server — Part 1 (SSH)

A simple way to run python code on remote machines through Jupyter Notebook interface.

medium.com

 

software 설치/제거 메뉴에서

1. jupyter interactive notebook 찾아서 설치
2. interactive computing environment (metapackage) 설치

 

3. 환경설정
$ jupyter notebook --generate-config

 

4. 암호설정
$ jupyter notebook password

Enter password: ****

Verify password: ****

[NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json

 

5. 해시된 패스워드 준비

In [1]: from notebook.auth import passwd

In [2]: passwd()

Enter password:

Verify password:

Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

이 패스워드를 jupyter_notebook_config.py에 다음과 같은 항목에 넣는다.

 

c.NotebookApp.password = u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

 

일단 이렇게 하면 앞의 jason 파일은 확장자를 고치고( *.org 처럼) 없앤다.

 

6. SSL 접속을 위한 준비

$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem

이렇게 mykey.key, mycert.pem 2가지 파일을 만든다.

 

5. 외부접속을 위한 설정 파일 수정

.jupyter/jupyter_notebook_config.py를 수정

c.NotebookApp.allow_origin='*'
c.NotebookApp.allow_remote_access=True
c.NotebookApp.open_browser=False

c.NotebookApp.certfile = '/absolute/path/mycert.pem'

c.NotebookApp.keyfile = '/absolute/path/mykey.key'

c.NotebookApp.ip = '*'

c.NotebookApp.password = u'sha1:bcd259ccf...'

c.NotebookApp.open_browser = False

c.NotebookApp.port =8888

 

참고
1. https://jupyter-notebook.readthedocs.io/en/stable/public_server.html

2. https://m.blog.naver.com/seodaewoo/221710100262



'Raspberry Pi' 카테고리의 다른 글

원격 ssh로 라즈베리파이 sdcard 백업하기  (0) 2020.01.25
How to run Jupyter Notebooks on remote server — SSH  (0) 2020.01.21
라즈베리파이4  (0) 2020.01.17
라즈베리파이4 방열판 효과  (0) 2020.01.16
fail2ban  (0) 2020.01.15

1. noobs 인스톨

참고 : https://www.raspberrypi.org/downloads/noobs/

 

Download NOOBS for Raspberry Pi

Download NOOBS - our easy operating system installer which contains Raspbian, and contains everything you'll need to get started with your Raspberry Pi.

www.raspberrypi.org

2. 한글 설치

입력기및 폰트 설치

$ sudo apt-get install uim uim-byeoru fonts-unfonts-core

uim을 입력기로 세팅

$ im-config -n uim

리부팅하고

 

입력기 메뉴 세팅

1) 전체적인 설정에서 벼루를 디폴트 입력기로

2) 툴바 displayay를 never로

3) 입력기전환메뉴에서 uim입력기전환메뉴사용에 체크

4) 전체적인키설정 메뉴에서 제일 위에 2개를 빈칸으로

5) 벼루키설정1 메뉴에서 위의 2개를 자신 입맛대로

 

참고 : https://bluexmas.tistory.com/875

 

Raspberry PI : 한글 환경 설정, 한글 입력기(uim) 설치

출처 Lubuntu 14.04 IBus 한글 입력기 버그 때문에 UIM 로 교체 : 멈춤보단 천천히라도 Ubuntu 18.04 한글 입력기 UIM 설정하기 ~ My Programming Trend Report 날아라 MaraSong :: 라즈베리파이3 RaspberryPi3 -..

bluexmas.tistory.com

3. sshd setting

참고 :

https://www.raspberrypi.org/documentation/remote-access/ssh/

http://blog.naver.com/PostView.nhn?blogId=bieemiho92&logNo=220913512849

 

4. node.js install
5. ufw install
6. fail2ban install
7. nginx install

'Raspberry Pi' 카테고리의 다른 글

원격 ssh로 라즈베리파이 sdcard 백업하기  (0) 2020.01.25
How to run Jupyter Notebooks on remote server — SSH  (0) 2020.01.21
Jupyter notebook 설치  (0) 2020.01.18
라즈베리파이4 방열판 효과  (0) 2020.01.16
fail2ban  (0) 2020.01.15

라즈베리파이4는 발열이 심하고 별도의 냉각이 필요하다. 괴난 걱정이 아니고 실제로 스로틀이나 심지어 다운될 수도 있다

발열대책시 유의점 결론
1. 그냥 놔두면 안된다
2. 방열판을 붙인다.
3. 방열판 효과는 그냥 붙이기만 하면 사실상 거의 효과가 없다. 방열판은 반드시 냉각팬과 같이 가야 된다.
4. 아이스 쿨러처럼 타워형 쿨러는 확실히 성능이 더 뛰어나다.

결론 : 편의성까지 고려하면 방열판 + 일반쿨러 또는 쿨러가 장착된 케이스로 하는 것이 가장 좋은 선택인 것 같다.

'Raspberry Pi' 카테고리의 다른 글

원격 ssh로 라즈베리파이 sdcard 백업하기  (0) 2020.01.25
How to run Jupyter Notebooks on remote server — SSH  (0) 2020.01.21
Jupyter notebook 설치  (0) 2020.01.18
라즈베리파이4  (0) 2020.01.17
fail2ban  (0) 2020.01.15

install
$ sudo apt-get install fail2ban

$ sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

이 파일에서 [sshd]를 찾아 다음 2줄을 추가한다
enabled = true
filter = sshd

다음 3줄도 추가

banaction = iptables-multiport
bantime = -1
maxretry = 3

참고
1. https://pimylifeup.com/raspberry-pi-fail2ban/


윈도우즈에서 파일이 많이 들어 있는 폴더를 삭제하고자 하면 시간계산으 ㄹ하느라 시간이 많이 걸린다.

이때는 멸영창에서 시행하면 시간을 20분의 1로 단축시킬수 있다.

 

윈도우 명령창을 열고

지우려고 하는 폴더의 바로 상위 폴더로 이동하여

 

$ rmdir /q /s '지우려는 폴더이름'

 

위와 같이 하면 1분내에 삭제된다

github 무료 계정은 용량이 500메가로 제한된다. 그러나 public repository는 무제한으로 500메가 제한에 포함되지 않는다.

 

그러나 public repository라도 크기가 100메가 이상인 파일은 올리지 못하게 되어 있다.

 

해결방법은

1. https://git-lfs.github.com/

 

Git Large File Storage

Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.

git-lfs.github.com

에 방문하여 파일을 다운 받아 설치한다. 윈도우에선 아무데서나 그냥 설치하면 된다.

 

2. 큰 파일이 들어간 local repository로 가서

3. git-bash 에서  다음과 같이 입력한다.

$ git lfs install

$ git lfs track "큰 파일 이름 또는 *.data 와 같은 형식"

$ git add .gitattributes

$ git add .

$ git commit -m "add a large file"

$ git push

 

와 같이 차례대로 하면 된다.

 

Basic type

  1. string
  2. number
  3. boolean
  4. null
  5. undefined
  6. Array
  7. Object

Predefined Class Object

  1. Array
  2. Boolean
  3. Data
  4. Function
  5. Math
  6. Number
  7. RegExp
  8. String

다음과 같은 간단한 명령로 만들수 있다. 단지 공인인증서가 아니고 사설인증서라는 것뿐이다
내가 만든 것은 내가 인정하니 상관없다.

1번 사이트에 나와있는 것을 순서대그 그대로 따라하면 된다. 여기에 apache2나 nginx 용으로 만들려면 참고2에 나와 있는 것처럼 인증서를 체인순서로 합친 것을 사용해야 된다.

 

Reference

1. https://juno.sh/ssl-self-signed-cert/  jupyter server 용으로는 여기 나와 있는데로만 하면 된다.

 

Accessing Jupyter on iOS over HTTPS

Follow these steps to prepare a self-signed SSL/TLS certificate for accessing Jupyter Notebook server from your iPhone or iPad over HTTPS

juno.sh

2. https://juno.sh/ssl-self-signed-cert/ nginx와 같은 httpd 서버에는 unified pem을 만들어야 한다.

 

Accessing Jupyter on iOS over HTTPS

Follow these steps to prepare a self-signed SSL/TLS certificate for accessing Jupyter Notebook server from your iPhone or iPad over HTTPS

juno.sh

 

3. https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/

 

How to Create Your Own SSL Certificate Authority for Local HTTPS Development

In my last article I described how to generate your own self-signed SSL certificates and add them to macOS Keychain so that your browser doesn’t give you a privacy error.… Read more

deliciousbrains.com

3. https://blog.naver.com/husheart/221688173365

 

OpenSSL 로 ROOT CA 생성 및 SSL 인증서 발급

https://www.lesstif.com/pages/viewpage.action?pageId=6979614개요 웹서비스에 https 를 적용할 경우 S...

blog.naver.com

 

'Ubuntu, Bash' 카테고리의 다른 글

nginx authentification  (0) 2020.01.23
서비스 확인 및 재시작  (0) 2020.01.05
ufw 기본적인 사항  (0) 2020.01.05
변수와 문자열 연산자  (0) 2019.12.26
shell script의 명령 인자 숫자 및 배열  (0) 2019.12.25

현재 내 우분투에서 서비스하고 있는 daemon을 확인하려면

 

$ service --status-all

 

sshd를  재시작하려면
$ service ssh restart

 

와 같이 하면 된다.

'Ubuntu, Bash' 카테고리의 다른 글

nginx authentification  (0) 2020.01.23
https 테스트를 위한 개인용 인증서 만들기  (0) 2020.01.05
ufw 기본적인 사항  (0) 2020.01.05
변수와 문자열 연산자  (0) 2019.12.26
shell script의 명령 인자 숫자 및 배열  (0) 2019.12.25

1. 활성화

$ sudo ufw enable

 

2. 현재 상태 종합 확인

$ sudo ufw status verbose

 

3. 디폴트 정책 선언

$ sudo ufw default deny

 

4. 특정 ip에서 오는 것만 허용

$ sudo ufw allow from 192.168.20.0/24 (to any port 22 proto tcp)

 

5. ssh 개방

$ sudo ufw allow 22/tcp

 

6. 넘버에 따라 삽입 또는 삭제, 또는 상태 확인

$ sudo ufw status numbered

$ sudo ufw insert 1 allow from 192.168.20.5 to any port 22

$ sudo ufw delete 2

 

 

 

아래 사이트를 참조

jekyll 사용에 관한 안내 블로그 Install Jekyll

 

Install Jekyll · Enjoy Jekylling!

 

vjinn.github.io

 

iteration

 

'반복'을 의미한다.

 

1. 파이썬에서 어떤 객체(object)가 iterable 하다고 할때는 다음 2가지 경우이다.

 

1) 물리적으로 저장된 sequence (차례)

2) for loop와 같은 iteration tool 환경에서 한번에 하나씩 결과를 만들어 내는 객체

 

 

2. 일반적인 성질, iterator

__next__ method를 통하여 한번에 하나씩 다음 결과로 진행하며 끝에 도달할 경우 StopIteration 에러를 발생시키는 모든 객체를 iterator 라고 한다.

 

3. iterable object, iterator, full iteration protocol

iterable object란 object.__iter__() 나 iter(object) 와 같은 방법으로 iterator를 만들 수 있는 객체를 말한다.

 

iterator란 object.__next__() 나 next(object) 와 같은 방법으로 차례대로 결과를 내고 끝에가서 StopIteration 을 발생시키는 객체를 발한다.

 

iterable object로부터 iterator object를 만들어 낸다.

 

아래에 예제에서 l 이 iterable object이며, a와 b가 iterator objects이다.

In [44]: l=list(range(10))

 

In [45]: l

Out[45]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

 

In [46]: a=iter(l)

 

In [47]: next(a)

Out[47]: 0

 

In [48]: next(a)

...:

Out[48]: 1

 

In [49]: next(a)

Out[49]: 2

 

In [50]: next(a)

Out[50]: 3

 

In [51]: b=l.__iter__()

 

In [52]: next(b)

Out[52]: 0

 

4. single vs multiple iterator

range object와 같은 것은 여러개의 iterator를 만들 수 있지만 map,zip,filter는 한개의 iterator만 만들 수 있다

 

'Python' 카테고리의 다른 글

jupyter notebook 테마적용  (0) 2020.01.26
( ) = ( ) if ( ) else ( ) 구문  (0) 2019.12.27
변수명  (0) 2019.12.27
python statements  (0) 2019.12.27
binary data pack unpack examples  (0) 2019.12.27

A=B if C else D

 

C 식을 평가하여 참이면 A=B 가 되고, 거짓이면 A=D 가 된다.

 

if C :

A=B

else :

A=D

와 같은 의미이며 간단하게는

 

A=[D, B][bool(C)]

와 같다.

 

상기 3개의 문장은 모든 같은 뜻이다.

 

'Python' 카테고리의 다른 글

jupyter notebook 테마적용  (0) 2020.01.26
iteration, iterable, iterator  (0) 2019.12.27
변수명  (0) 2019.12.27
python statements  (0) 2019.12.27
binary data pack unpack examples  (0) 2019.12.27

특수한 변수명

 

1. _string 형태

from module import * 구문에서 import되지 않는다.

interactive한 환경에서는 마지막 expression(표현식)의 결과를 보전하고 있다.

 

2. __string__

시스템에서 정의하는 이름으로 특별한 의미를 갖는다. 사용자는 이러한 형태로 변수명을 만들면 안된다.

 

3. __string

enclosing class에 국한되는 변수들

 

변수명을 짓는 습관

1. 클래스명은 대문자로 시작

2. 모듈명은 소문자로 시작

 

'Python' 카테고리의 다른 글

iteration, iterable, iterator  (0) 2019.12.27
( ) = ( ) if ( ) else ( ) 구문  (0) 2019.12.27
python statements  (0) 2019.12.27
binary data pack unpack examples  (0) 2019.12.27
struct : binary data packing & unpacking options  (0) 2019.12.27

파이선 프로그램은 module들로 이루어져 있으며, module 안에는 statement들이 있고, statement는 expression을 포함하고 있다.

 

파이선 statements 의 종류

1. assignment

2. calls

3. print calls

4. if/elif/else

5. for

6. while

7. pass

8. break

9. continue

10. def

11. return

12. yield

13. global

14. nonlocal

15. import

16. from

17. class

18. try/except/finally

19. raise

20. assert

21. with as

22. del

 

'Python' 카테고리의 다른 글

( ) = ( ) if ( ) else ( ) 구문  (0) 2019.12.27
변수명  (0) 2019.12.27
binary data pack unpack examples  (0) 2019.12.27
struct : binary data packing & unpacking options  (0) 2019.12.27
list comprehension과 for loop 벤치  (0) 2019.12.27

+ Recent posts