Tuesday, March 31, 2020

Django lint in Visual Studio Code

In C:\Users\[user name]\AppData\Roaming\Code\User\settings.json,
apply orange highlight.


{
    "diffEditor.ignoreTrimWhitespace": false,
    "window.zoomLevel": 3,
    "editor.tabSize": 2,
    "editor.insertSpaces": false,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "[python]": {},
    "python.linting.pylintPath": "D:\\dvp\\project\\env\\Scripts\\pylint",
    "editor.minimap.enabled": false,
    "python.linting.pylintArgs": [
        "--load-plugins", "pylint_django"
    ]
,

    "python.linting.flake8CategorySeverity.E": "Information",
    "python.linting.pydocstyleEnabled": true
}



For a project, the setting is in .vscode folder:

{
    "python.pythonPath": "env\\Scripts\\python.exe",
    "python.linting.enabled": true,
    "python.linting.banditEnabled": false,
    "python.linting.pydocstyleEnabled": false,
    "python.linting.pylintEnabled": true,
    "python.linting.flake8Enabled": false
}

Saturday, March 28, 2020

Windows termainal ssh

It's much straight forward to use wsl ssh instead of powershell.

In linux, you can ssh to other server by
sshpass -p [password] ssh [user name]@[server]


I just put it together with wsl and works.
Try this profile in your windows terminal profile

{
  "hidden": false,
  "name": "ssh 2 remote",
  "commandline": "ubuntu.exe run \"sshpass -p [password] ssh [user name]@[server]\"",
  "icon": "D:/dvp/project.png"

}

Make sure sshpass installed
or
sudo apt-get install sshpass

Reset WSL password





C:\Users\alex>ubuntu config --default-user root

C:\Users\alex>ubuntu.exe
root@DESKTOP-GN4RPTT:~# whoami
root


root@DESKTOP-GN4RPTT:~# tail -3 /etc/passwd
sshd:x:109:65534::/run/sshd:/usr/sbin/nologin
pollinate:x:110:1::/var/cache/pollinate:/bin/false
alex:x:1000:1000:,,,:/home/alex:/bin/bash
root@DESKTOP-GN4RPTT:~# passwd alex
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@DESKTOP-GN4RPTT:~# exit
logout

C:\Users\alex>ubuntu config --default-user alex



Windows Terminal profile open up sqlite

For a specific data source :

Open Settings
 
{
  "hidden": false,
  "name": "sqlite",
  "commandline": "C://Windows//SysWOW64//cmd.exe /k \"D://db.bat\""

}


or

{
  "commandline": "powershell.exe /c \"D://db.bat\"",
  "hidden": false,
  "name": "sqlite ps",
  "icon": "D:/dvp/sqlite/sqlite.png"

}


The db.bat is

d:\apps\sqlite\sqlite3.exe d:\projects\db.sqlite3 

 

Just Open sqlite command:

{
  "commandline": "powershell.exe /c \"D://db.bat\"",
  "hidden": false,
  "name": "sqlite ps",
  "icon": "D:/dvp/sqlite/sqlite.png"

}
 

Tuesday, March 10, 2020

kubernets cheat sheets

List helm installation
helm list

Search helm chart
helm search [release name]

helm del [release name]-[chart name] --purge

kubectl delete ns [namespace]

kubectl get pod -n [namespace]

helm install [release name] [chart name]

kubectl logs --follow [pod name] -n [namespace]

List pods and output to YAML
kubectl get pod -o yaml


kubectl describe pod [pod name] -n [namespace]