kubectl plugin tab auto complete not working with zsh - kubectl

After installing kubernetes-cli via homebrew in a mac with zsh, the kubernetes auto complete is not working completely or in full. Only the first tab works and not the second tab onwards. Example, if I type kubectl [TAB], it displays the sub commands for kubectl, and now if I select a sub command and press [TAB], eg kubectl get [TAB], it freezes for a lot of time and nothing happens there after.
I tried the following ways
Installed kubectl-cli via home brew
enabled zsh plugin
added the below code as well
source <(kubectl completion zsh)
autoload -Uz compinit
compinit

Finally this worked after referring to https://kubernetes.io/docs/reference/kubectl/cheatsheet/#zsh
echo '[[ $commands[kubectl] ]] && source <(kubectl completion zsh)' >> ~/.zshrc # add autocomplete permanently to your zsh shell
The below did not work
https://kubernetes.io/docs/tasks/tools/included/optional-kubectl-configs-zsh/

Related

Failed to start a TensorBoard session in vscode due to the following error:

To launch tensorboard in vscode, I did the following steps:
select a python interpreter path
choose Python:Launch TensorBoard
and then I get this error:
We failed to start a TensorBoard session due to the following error: Command failed: conda activate ldl && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/cxy/.vscode-server/extensions/ms-python.python-2022.18.2/pythonFiles/printEnvVariables.py
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If your shell is Bash or a Bourne variant, enable conda for the current user with
$ echo ". /home/cxy/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc
or, for all users, enable conda with
$ sudo ln -s /home/cxy/anaconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh
The options above will permanently enable the 'conda' command, but they do NOT
put conda's base (root) environment on PATH. To do so, run
$ conda activate
in your terminal, or to put the base environment on PATH permanently, run
$ echo "conda activate" >> ~/.bashrc
Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
your ~/.bashrc file. You should manually remove the line that looks like
export PATH="/home/cxy/anaconda3/bin:$PATH"
^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
I have tried the suggested command, which is
echo ". /home/cxy/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc
but it doesn't work, I still get the same error.
How can I solve this problem? Is there any suggestion? thanks in advance!!!
I have solved this problem!!!
Basically, it is caused by the latest version of Python and Pylance extension in vscode, all we have to do is simply downgrade the two extensiona and make sure vscode won't update them automatically.
So, do the following:
Downgrade Python extension and Pylance extension to eariler version, like v2021.10.xx and v2021.10.0 respectively.
Close the extension auto update in vscode, to ensure the downgradion in step1 works after restarting vscode.
Specifically, openSettings and search for the keyword update, do the following:
2.1. beneath the Update: Mode,select None instead of default
2.2. beneath the Extensions: Auto Update, select None instead of All extensions
After I did the above steps, the problem just disappeared. I can then launch tensorboard by shift+cmd+P and select Python:Launch TensorBoard.

Why am I receiving an 'sbserver not found' error when attempting to set up Google Safe Browsing Database?

I reached this GitHub repo. about google safe browsing database.
I have never used go, but I think it is required now. So I installed it using:
sudo apt install golang-go
Then, I followed the instructions in the GitHub page. I executed:
go get github.com/google/safebrowsing
But nothing installed in the path I was executing the command from. However, I proceeded to:
export PATH=$PATH:$GOPATH/bin
Then the manual says, run the following command (which is two lines, I executed the first line, then I press enter, then nothing changes. Then executed the second line separately:
go get github.com/google/safebrowsing/cmd/sbserver
sbserver -apikey $APIKEY
After executing the second line, I got this error:
Command 'sbserver' not found, did you mean:
command 'sxserver' from deb sx
command 'sb_server' from deb spambayes
command 'ssserver' from deb shadowsocks
Try: sudo apt install <deb name>
Can you please point to me what is wrong? How to install google safe browsing database?
Your PATH is wrong. You will find sbserver in $GOPATH/bin.
Try ${GOPATH}/bin/sbserver -apikey $APIKEY
If that does not work, then follow the Go installation instructions and make sure that your Go environment variables are correct.
GOPATH should look like /home/myname/go or something else that looks normal.
Your PATH should contain ${GOPATH}/bin

prevent msys shell from translating path-like strings

I'm trying to use docker for windows in msys
docker run -v /c/some/dir:/inside/container ...
gets munged into
c:\\some\\dir;c:\\msys\\inside\\container ...
How do i disable the translation?
It's MSYS2_ARG_CONV_EXCL, see https://github.com/msys2/msys2/wiki/Porting

Installed go with hombrew, can find $GOROOT causing package failures

I installed Go with homebrew and it usually works. Following the tutorial here on creating serverless api in Go. When I try to run the unit tests, I get the following error:
# _/Users/pro/Documents/Code/Go/ServerLess
main_test.go:6:2: cannot find package "github.com/strechr/testify/assert" in any of:
/usr/local/Cellar/go/1.9.2/libexec/src/github.com/strechr/testify/assert (from $GOROOT)
/Users/pro/go/src/github.com/strechr/testify/assert (from $GOPATH)
FAIL _/Users/pro/Documents/Code/Go/ServerLess [setup failed]
Pros-MBP:ServerLess Santi$ echo $GOROOT
I have installed the test library with : go get github.com/stretchr/testify
I would appreciate it if anyone could point me in the right direction.
Also confusing is when I run echo $GOPATH it doesnt return anything. same goes for echo $GOROOT
Some things to try/verify:
As JimB notes, starting with Go 1.8 the GOPATH env var is now optional and has default values: https://rakyll.org/default-gopath/
While you don't need to set it, the directory does need to have the Go workspace structure: https://golang.org/doc/code.html#Workspaces
Once that is created, create your source file in something like: $GOPATH/src/github.com/DataKid/sample/main.go
cd into that directory, and re-run the go get commands:
go get -u -v github.com/stretchr/testify
go get -u -v github.com/aws/aws-lambda-go/lambda
Then try running the test command again: go test -v
The -v option is for verbose output, the -u option ensures you download the latest package versions (https://golang.org/cmd/go/#hdr-Download_and_install_packages_and_dependencies).

Disable Qt traces on Ubuntu system

For some reason, whatever Qt-based application I start from a terminal issues some traces I would like to disable.
Example:
$> qtcreator
Got bus address: "unix:abstract=/tmp/dbus-vDsC42Ojkq,guid=dc44d5a0e955ae51a4dbbdc100001ce3"
Connected to accessibility bus at: "unix:abstract=/tmp/dbus-vDsC42Ojkq,guid=dc44d5a0e955ae51a4dbbdc100001ce3"
Registered DEC: true
Registered event listener change listener: true
...
...
Do anyone know how to get rid of these messages?
Thanks.
Thanks to Laszlo Papp comment, I took a look to qt-at-spi setup...
$> locate qt-at-spi
/usr/share/doc/qt-at-spi
/usr/share/doc/qt-at-spi/README
/usr/share/doc/qt-at-spi/changelog.Debian.gz
/usr/share/doc/qt-at-spi/copyright
/var/lib/dpkg/info/qt-at-spi:amd64.list
/var/lib/dpkg/info/qt-at-spi:amd64.md5sums
Let's see what README file tells:
$> more /usr/share/doc/qt-at-spi/README
Qt AT-SPI2 bridge
=================
This is a Qt plugin that bridges Qt's accessibility API to AT-SPI2.
With recent versions of AT-SPI2 this should make Qt applications accessible
with the help of tools such as Gnome's Orca screen-reader.
Switch gnome to use at-spi2:
gconftool-2 --set /desktop/gnome/interface/at-spi-dbus --type bool true
gconftool-2 --set /desktop/gnome/interface/at-spi-corba --type bool false
To run gnome apps with at-spi2 in a non-gnome session:
export GTK_MODULES=gail:atk-bridge
Qt will only load this plugin when the environment variable
QT_ACCESSIBILITY is set to 1.
And like the README says, QT_ACCESSIBILITY environment variable was set to 1 on my machine.
So the solution is:
EITHER to remove qt-at-spi module:
sudo dpkg --purge qt-at-spi
OR to unset this variable, which, after a quick research was set in /etc/X11/Xsession.d/90qt-a11y script, based on gnome settings:
gsettings set org.gnome.desktop.interface toolkit-accessibility false
Thank you Laszlo!
I usually redirect all output of GUI apps started from a terminal:
$> qtcreator >/dev/null &
You either need to remove the qt-at-spi package or use QT_ACCESSIBILITY=0 qtcreator.
Here you can find the official README under the KDE umbrella for details:
https://projects.kde.org/projects/playground/accessibility/qtatspi/repository/revisions/master/entry/README