2023. 12. 30.

자주 쓰지만 자꾸 잊어 먹는, ssh 암호없이 키로 접속하기

기본단계

 1) 키페어 생성

     ~/.ssh/id_rsa         # private key

    ~/.ssh/id.rsa.pub  # public key ( 다른 서버에 복사해야할 파일)

2) pub 키를 접속할 호스트로 복사

      scp  ~/.ssh/id_rsa   remoteuser@remotehost:id_rsa.tmp 

3)  ssh 접속후 키 복사 (기존 파일에 붙여 넣기 ) 

       cat   id_rsa.tmp >> ~/.ssh/authorized_keys

4) 이후 패스워드 없이 접속

ssh remoteuser@remotehost


2023. 11. 18.

Install Virtualenv on osX (MAC)

 1) Install brew 

     home page:  https://brew.sh/

2 ) Install python3 

  $>  brew install python3

3) Install virtualenv

  $> pip3 install virtualenv

4) check installed python version

   ls -l /usr/local/bin/python*

5) make Local Env 

  $> python3 -m virtualenv  venv310 --python=/usr/local/bin/python3.10

     // venv310 :  directory which contains python3.10 data 

     // --python={installed path}  :  source path which is selected python version

2023. 7. 15.

Passing custom event function from parent component to child in react

 


Passing  function  from parent to child component 
for click-event customizing 

1) define function in app level

    function. custom_event (key, event) {

      // this is custom function 

      console.log ("call custom function ") ;

    }

2) passing custom function to child by property

     when click item ,  item calls internalClick

       custom_event function is called by name "customFunction" in internalClick function 

        


// in app.js     

  function. custom_event (key, event) {

      // this is custom function 

      console.log ("call custom function ") ;

    }

 <BoardList  customFunction= { this.props.custom_event }  />    


//  in BoardList.js

      // some loop ... 

     <BoardRow keyField={ this.props.keyField}   customFunction = { this.props.customFunction} /> 


//  in BoardRow.js 

     <BoardItem keyField={ this.props.keyField} customFunction = { this.props.customFunction} /> 

// in BoardItem.js 

     internalClick = (e) => {

       console.log ( "click item ") ;

       this.props.customFunction(this.props.keyField , e) ;

     }

    render() {

          return (<button  onClick = { this.internalClick } > click </button>)

    }

    

      

    



Python new string format (update) f-string

 Update .. 

Late news 


My previous post:  2016 

https://blog.boxstory.com/2016/08/python-new-string-format.html


New Addition  :  f-string   ( support  from 3.6 )

variable = 'hello'
print(f' my variable is {variable}') # using f' xxxx {variable_name}'


 # output 
my variable is hello 

# Yes , It's very simple and powerful.