from notebook.auth import passwd   

 

해당 모듈  import  시 설치가 되어 있지 않다고  나올 경우

(base) root@jupyterlab-deployment-96d5cd489-kjrd4:~# jupyter notebook --generate-config
Writing default config to: /home/jovyan/.jupyter/jupyter_notebook_config.py

 

 

!pip3 install notebook==6.5.5

 

이렇게 해서 해결이 안되면

 

!pip3 install --upgrade ipython 

요렇게 도 해본다

 

다시

from notebook.auth import passwd    

 

# 아래 전체가 암호이다

'argon2:$argon2id$v=19$m=10240,t=10,p=8$QbPT9aYvhdqRFecguJX5sg$ArunzaJ65DCEA6MnCL7N9Y2m0Y1XwVCR3N95PC3lGxE'

 

 

(base) root@jupyterlab-deployment-96d5cd489-kjrd4:~/.jupyter# vi jupyter_notebook_config.py

 

 없으면 추가

 

c.ServerApp.password_required = True
c.PasswordIdentityProvider.hashed_password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$QbPT9aYvhdqRFecguJX5sg$ArunzaJ65DCEA6MnCL7N9Y2m0Y1XwVCR3N95PC3lGxE'

 

 

deply.yaml 에서 

           chmod -R 777 /home/jovyan/work
              start.sh jupyter lab --LabApp.token='password' --LabApp.ip='0.0.0.0' --LabApp.allow_root=True


        해당 부분을   

start.sh jupyter lab --LabApp.token='' --LabApp.password='' 

 

이렇게 변경

해당 부분을

 

 

 

jupyter-deploy.txt
0.00MB

 

 

apiVersion: apps/v1
kind: Deployment
metadata:
  name: jupyterlab-deployment
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jupyterlab
  template:
    metadata:
      labels:
        app: jupyterlab
    spec:
      securityContext:
        runAsUser: 0
        fsGroup: 0
      containers:
        - name: jupyterlab
          image: jupyter/datascience-notebook:latest
          imagePullPolicy: IfNotPresent
          ports:
          - containerPort: 8888
          command:
            - /bin/bash
            - -c
            - |
              chmod -R 777 /home/jovyan/work
              start.sh jupyter lab --LabApp.token='' --LabApp.password='' --LabApp.ip='0.0.0.0' --LabApp.allow_root=True
              #start.sh jupyter lab --LabApp.token='password' --LabApp.ip='0.0.0.0' --LabApp.allow_root=True
          volumeMounts:
            - name: jupyterlab-data
              mountPath: /home/jovyan/work
              #mountPath: /data
            - name: jupyterlab-config
              mountPath: /home/jovyan/.jupyter
          securityContext:
              runAsUser: 0
          resources:
            requests:
              memory: 500Mi
              cpu: 250m
      restartPolicy: Always
      volumes:
      - name: jupyterlab-data
        #persistentVolumeClaim:
        #claimName: fileshare-pvc
        hostPath:
           path: /home/sysic/Data
      - name: jupyterlab-config
        hostPath:
           path: /home/sysic/config

 

################### 홈 디렉토리 변경하기 #########################################

 

(base) root@jupyterlab-deployment-6886db8858-rf68k:~/.jupyter# pwd
/home/jovyan/.jupyter
(base) root@jupyterlab-deployment-6886db8858-rf68k:~/.jupyter# more jupyter_notebook_config.py |grep jaeyon
c.ServerApp.root_dir = '/home/jaeyong'
(base) root@jupyterlab-deployment-6886db8858-rf68k:~/.jupyter#



apiVersion: apps/v1
kind: Deployment
metadata:
  name: jupyterlab-deployment
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jupyterlab
  template:
    metadata:
      labels:
        app: jupyterlab
    spec:
      securityContext:
        runAsUser: 0
        fsGroup: 0
      containers:
        - name: jupyterlab
          image: jupyter/datascience-notebook:latest
          imagePullPolicy: IfNotPresent
          ports:
          - containerPort: 8888
          command:
            - /bin/bash
            - -c
            - |
              chmod -R 777 /home/jaeyong
              #chmod -R 777 /home/jovyan/work
              start.sh jupyter lab --LabApp.token='' --LabApp.password='' --LabApp.ip='0.0.0.0' --LabApp.allow_root=True
              #start.sh jupyter lab --LabApp.token='password' --LabApp.ip='0.0.0.0' --LabApp.allow_root=True
          volumeMounts:
            - name: jupyterlab-data
              mountPath: /home/jaeyong
              #mountPath: /home/jovyan/work
              #mountPath: /data
            - name: jupyterlab-config
              mountPath: /home/jovyan/.jupyter
          securityContext:
              runAsUser: 0
          resources:
            requests:
              memory: 500Mi
              cpu: 250m
      restartPolicy: Always
      volumes:
      - name: jupyterlab-data
        #persistentVolumeClaim:
        #claimName: fileshare-pvc
        hostPath:
           path: /home/sysic/Data
      - name: jupyterlab-config
        hostPath:
           path: /home/sysic/config

 

 

 

 

 

*

application/octet-stream

 

'나는 노동자 > 이런저런 Tip' 카테고리의 다른 글

iPhone 강제로 재시동하기  (0) 2023.11.03
ntp offset 추출 - ansible  (0) 2023.07.23
미드저니 기본 명령어  (0) 2023.05.13
windows os hostname s/n ip  (0) 2023.03.20
grafana plugin 수동설치  (0) 2023.03.03

'나는 노동자 > 이런저런 Tip' 카테고리의 다른 글

IIS FILE HTTP 오류 404.3 - Not Found  (0) 2023.12.12
ntp offset 추출 - ansible  (0) 2023.07.23
미드저니 기본 명령어  (0) 2023.05.13
windows os hostname s/n ip  (0) 2023.03.20
grafana plugin 수동설치  (0) 2023.03.03

패턴은  ntpq -p에서 

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 2.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 3.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.000
-send.mx.cdnetwo 125.185.190.74   2 u   58   64  377    1.035   -2.002   1.485
*121.162.54.1    13.209.84.50     3 u   60   64  377    2.872    1.390   0.772
+121.174.142.82  220.73.142.66    3 u   58   64  377    8.309   -3.675   1.064
+mail.innotab.co 13.209.84.50     3 u   55   64  377    2.898   -2.468   0.951
-121.174.142.81  220.73.142.66    3 u   59   64  377    7.741   -1.928   1.586

 

+121.174.142.82  220.73.142.66    3 u   58   64  377    8.309   -3.675   1.06
-121.174.142.81  220.73.142.66    3 u   59   64  377    7.741   -1.928   1.586

요부분  오프셋 추출

 

응용해서 사용하길 

 

 ---
- name: Get NTP offset values from remote servers
  hosts: your_remote_servers  # 특정 원격 서버의 호스트 그룹 또는 호스트명으로 변경해주세요.
  gather_facts: yes

  tasks:
    - name: Get NTP offset from remote servers
      shell: "ntpq -p | awk '/^[+-]?[0-9]+\\.[0-9]+/ { print $9 }'"
      register: ntp_offsets_raw

    - name: Extract NTP offset values
      set_fact:
        ntp_offsets: "{{ ntp_offsets_raw.stdout_lines | select('match', '^[+-]?[0-9]+\\.[0-9]+') | map('float') | list }}"
      when: ntp_offsets_raw.stdout_lines is defined

    - name: Save NTP offset to file
      block:
        - name: Save NTP offset to file with two values
          copy:
            content: |
              {% if ntp_offsets | length >= 1 %}
              off1={{ ntp_offsets[0] }}
              {% endif %}
              {% if ntp_offsets | length >= 2 %}
              off2={{ ntp_offsets[1] }}
              {% endif %}
            dest: /home/ansible/result.txt
          when: ntp_offsets | length >= 1


'나는 노동자 > 이런저런 Tip' 카테고리의 다른 글

IIS FILE HTTP 오류 404.3 - Not Found  (0) 2023.12.12
iPhone 강제로 재시동하기  (0) 2023.11.03
미드저니 기본 명령어  (0) 2023.05.13
windows os hostname s/n ip  (0) 2023.03.20
grafana plugin 수동설치  (0) 2023.03.03

https://deepdaive.com/wp-content/uploads/2023/05/image-12.png

'나는 노동자 > 이런저런 Tip' 카테고리의 다른 글

iPhone 강제로 재시동하기  (0) 2023.11.03
ntp offset 추출 - ansible  (0) 2023.07.23
windows os hostname s/n ip  (0) 2023.03.20
grafana plugin 수동설치  (0) 2023.03.03
grafana table column변경  (0) 2022.07.20

for i in $(cat file.txt); do
    if rpm -qa | grep -qw $i; then
        echo "$i is installed."
    else
        echo "$i is not installed."
    fi
done

'나는 노동자 > LINUX' 카테고리의 다른 글

ansible extra vars  (0) 2023.02.13
ansible 물리서버, 가성서버 확인  (0) 2023.02.07
ansible facts device check  (0) 2023.02.04
리눅스 임시 포트 오픈  (0) 2023.01.12
xfs volume extend  (0) 2020.07.10

api = azure function (included chatgpt)

yo office 

 

 

taskpane.js

 

export async function run() {
  /**
   * Insert your Outlook code here
   *
   */
  let body = ''

  async function outputResult(body){
    console.log(body)
    let response = await runAzure(body)
    console.log(response.output)
  }
  async function getBody(){
    Office.context.mailbox.item.body.getAsync("text", function(result) {
      if (result.status == Office.AsyncResultStatus.Succeeded) {
        body = result.value
        outputResult(body)
      }
    })

  }

  async function runAzure(body) {
  const Url = 'your api site address';
  const otherParam = {
    body: '{"model":"text-davinci-003","prompt":"summarize the following in 50 words or less: ' + body.replace(/['"]+/g, '').trim().replace(/(\r\n|\n|\n)/gm, "") + '","max_tokens":200,"temperature":0}',
    method: 'POST'
  };
  const response = await fetch(Url,otherParam);
  var output = await response.text()
  return {output}

  }

  await getBody()
}
 
 
위 내용을 조금 다르게...  로그내용 출력
 
export async function run() {
  /**
   * Insert your Outlook code here
   *
   */
  let body = ''

  async function outputResult(body){
    console.log(body)
    let response = await runAzure(body)
    console.log(response.output)
  }
  async function getBody(){
    Office.context.mailbox.item.body.getAsync("text", function(result) {
      if (result.status == Office.AsyncResultStatus.Succeeded) {
        body = result.value
        outputResult(body)
      }
    })

  }

  async function runAzure(body) {
  const Url = 'your api address';
  const bodyjson = '{"model":"text-davinci-003","prompt":"summarize the following in 50 words or less: ' + body.replace(/['"]+/g, '').trim().replace(/(\r\n|\n|\n)/gm, "") + '","max_tokens":200,"temperature":0}'
  console.log(bodyjson)
  const otherParam = {
    body: bodyjson,
    method: 'POST'
  };
  const response = await fetch(Url,otherParam);
  var output = await response.text()
  return {output}

  }

  await getBody()
}

your api address = azure function [for chatgpt api : post]

 

메일 내용을 요약해서 보여줌

 

/*
 * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
 * See LICENSE in the project root for license information.
 */

/* global document, Office */

Office.onReady((info) => {
  if (info.host === Office.HostType.Outlook) {
    document.getElementById("sideload-msg").style.display = "none";
    document.getElementById("app-body").style.display = "flex";
    document.getElementById("run").onclick = run;
  }
});

export async function run() {
  /**
   * Insert your Outlook code here
   *
   */
  let body = ''

  async function outputResult(body){
    console.log(body)
    let response = await runAzure(body)
    console.log(response.output)
    document.getElementById('app-body').innerHTML = "<b>Summary: </b><br/>" + response.output
  }
  async function getBody(){
    Office.context.mailbox.item.body.getAsync("text", function(result) {
      if (result.status == Office.AsyncResultStatus.Succeeded) {
        body = result.value
        outputResult(body)
      }
    })

  }

  async function runAzure(body) {
  const Url = 'your ajpi site address';
  const bodyjson = '{"model":"text-davinci-003","prompt":"summarize the following in 50 words or less: ' + body.replace(/['"]+/g, '').trim().replace(/(\r\n|\n|\n)/gm, "") + '","max_tokens":200,"temperature":0}'
  console.log(bodyjson)
  const otherParam = {
    body: bodyjson,
    method: 'POST'
  };
  const response = await fetch(Url,otherParam);
  var output = await response.text()
  return {output}

  }

  await getBody()
}

 

Summarize This Email 선택시 기존에서는 콘솔(개발자모드)에서 내용이 보였으나 이젠 그냥 화면에 보임

 

 

Full+code+in+task_pane.js.txt
0.00MB
Fake+email.txt
0.00MB
CORS+policy.txt
0.00MB

 

회신기능

 

export async function run() {
  /**
   * Insert your Outlook code here
   */

  const item = Office.context.mailbox.item
  async function getBody(){
    Office.context.mailbox.item.body.getAsync("text",function(result){
      if (result.status == Office.AsyncResultStatus.Succeeded){
        let body =  result.value
       
        PutItAllTogether(body)
     
      }
    })
  }
async function RunAPI(body){
  const Url = 'https://~'
  const bodyJson ='{"model":"text-davinci-003","prompt":"Reply to the following email and  politely and professionally manner while saying no '+  body.replace(/['"]+/g, '').trim().replace(/(\r\n|\n|\r)/gm, "") +'","max_tokens":400,"temperature":0}'
  console.log(bodyJson)
  const otherParam = {
    body: bodyJson,
    method: 'POST'
  }
  const response = await fetch(Url, otherParam)
  var output = await response.text()

  return {output}

}

async function PutItAllTogether(body){

  console.log(body)
  let response = await RunAPI(body)
  console.log(response)
  item.displayReplyForm(response.output)
}

await getBody()
}

 

Generate Reply 클릭시 - 자동회신 양식을 띄우고 회신 내용을 자동으로 채워줌 

 

@echo off
:::::::::::::::::::::::::::::::::::::::::::::::
:: OS Name
:: HOSTNAME
:: S/N
:: IP-ADDRESS
:::::::::::::::::::::::::::::::::::::::::::::::
 

wmic OS get Name
wmic computersystem get name
wmic bios get serialnumber 
ipconfig | find /i "IPv4"

 

test.bat
0.00MB

  그냥 cmd     창에서 실행하면 됨

'나는 노동자 > 이런저런 Tip' 카테고리의 다른 글

ntp offset 추출 - ansible  (0) 2023.07.23
미드저니 기본 명령어  (0) 2023.05.13
grafana plugin 수동설치  (0) 2023.03.03
grafana table column변경  (0) 2022.07.20
rancher password reset  (0) 2021.09.02

https://grafana.com/grafana/plugins/?search=clock  

 

 여기서  타입 검색

아래 내리다 보면  Download   라고 있음 .. 클릭

   Plugins  설치

root@DESKTOP-F4T7TCG:/usr# cd /etc
root@DESKTOP-F4T7TCG:/etc# cd grafana
root@DESKTOP-F4T7TCG:/etc/grafana# ls
grafana.ini  ldap.toml  provisioning

 

 vi grafana.ini

#################################### Paths ####################################
[paths]
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
;data = /var/lib/grafana

# Temporary files in `data` directory older than given duration will be removed
;temp_data_lifetime = 24h

# Directory where grafana can store logs
;logs = /var/log/grafana

# Directory where grafana will automatically scan and look for plugins
plugins = /var/lib/grafana/plugins

 

 

 

root@DESKTOP-F4T7TCG:/var/lib/grafana# cd plugins/
root@DESKTOP-F4T7TCG:/var/lib/grafana/plugins# ls
grafana-clock-panel-2.1.2.any.zip  
root@DESKTOP-F4T7TCG:/var/lib/grafana/plugins#

 

unzip grafana-clock-panel-2.1.2.any.zip

mv granana-clock-panel clock

 

==========참고=-============

  plugins   경로 변경

$ /usr/local/grafana/bin/grafana-cli --pluginsDir /data/grafana/plugins/ plugins ls

====================================

 

 

systemctl restart grafana

 

grafana plugin 에서 설치 확인

 

 

-----------

https://grafana.com/grafana/plugins/flant-statusmap-panel/?tab=installation 

 

Statusmap plugin for Grafana | Grafana Labs

Monitoring COVID-19 virus levels in wastewater using Grafana, Databricks, and the Sqlyze plugin

grafana.com

 

grafana-clock-panel-2.1.2.any.zip
0.44MB
flant-statusmap-panel-0.5.1.zip
0.28MB

 

'나는 노동자 > 이런저런 Tip' 카테고리의 다른 글

미드저니 기본 명령어  (0) 2023.05.13
windows os hostname s/n ip  (0) 2023.03.20
grafana table column변경  (0) 2022.07.20
rancher password reset  (0) 2021.09.02
아이폰 벨소리 -대략 1분 정도  (0) 2020.09.29

${__to:date:MMDDHH}

 ${__to}
 
디비의 table이 TABLE명-YYMMDDHH 형태 이름으로 나누어져 있음
 DASHBOARD의 TIME RANGEㅇㅔ서 값을 받아서.. 현재 선택 시간과 이전 시간(-1)을 보여 주고자함
QUERY를 두개 만들어서
하나는 선택, 하나는 -1 값으로 해주면 됨 
두개 그래프에 LEGEND가 2개 나타나는ㄷㅔ 색을 동일 패턴으로 만들어줌(그림 LEGEND 항목에 마우스 클릭)
하나만 보여주는건 나중에 할 생각.. 아래 패턴 찾는것도 시간을 너무 허비해서..낮은 버젼은 모르겠음
 
 
  time range값을 변수로 받아옴
 ${__from:date:YYMMDDHH}
 
현재 시간보다 -9 시간이라 ${__from  값보다 시간 늦은 갑을 구할때 사용 - dashboard variable에서 등록해서 변수로 사용하면 좋을듯

SELECT to_char(to_timestamp(${__from:date:seconds}) + INTERVAL '8 hour', 'YYMMDDHH')

대쉬보더 변수에서 refresh에 시간병경시 refresh선택해줘야함
 
 ${__to:date:YYMMDDHH}
 
 "re-${__from:date:YYMMDDHH}"

 

 

test 용

SELECT COALESCE(to_char(to_timestamp(${__from:date:seconds}) + INTERVAL '12 hour', 'YYMMDDHH24'), to_char(to_timestamp(${__from:date:seconds}, 'YYMMDDHH24') )

+ Recent posts