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

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

Related

gcloud stop working - "was unexpected at this time."

I just update my google cloud SDK on windows 10 (gcloud components update).
After the update the gcloud command stop working.
All I get is (for example : gcloud -h):
PATH\lib\gcloud.py" -h" was unexpected at this time.
I try to re-install but it didn't help:(
As noted in the other answers, this is a bug with the 274.0.0 version of gcloud. Another report of this issue actually identifies where the bug is and offers this fix:
If you are stuck and need an immediate solution, here's a workaround that will move you forward, but you should reinstall the Cloud SDK from scratch when a fix is ready.
Open C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk-bin\gcloud.cmd in your editor
Near line 170, change ) ELSE ( to be just )
Remove the ) on the last line in the file.
That should get you working in the short term (albeit with an extraneous error message every time you run a command). After getting it working you can revert to version 273.0.0 (so that you stop getting the error message and aren't using a modified version) using:
gcloud components update --version=273.0.0
This is being tracked in the public bug https://issuetracker.google.com/issues/146458519
We have a patch for two files that are causing these problems. These apply in two cases (both on Windows):
1. A new install fails, or
2. You are unable to run gcloud after performing a components update.
For case # 1, please download the attached file install.bat, and copy it to the location where you have attempted to install gcloud, e.g. C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk. Then run it, e.g.
cd C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk
.\install.bat
For both cases #1 and #2, download the attached file gcloud.cmd, and copy it to the bin directory under your gcloud installation, e.g.
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin. When prompted to replace the previous copy, type Yes. This should allow you to run gcloud without being prompted to set CLOUDSDK_PYTHON.
The files are attached in the public bug tracker.
This is a known issue that is being tracked here
After hours of trying to fix it! I found how :)
uninstall google SDK
https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.zip
https://cloud.google.com/sdk/docs/downloads-interactive#interactive_installation
This fix the bug.
After that I had new bug in pyCharm GAE:
ImportError: No module named _subprocess
I fix this with the solution here:
Error importing built-in module "_subprocess" using Google Cloud Platform's Local Development Server
Hope this helps and saves a lot of trouble for you guys :)
I solved this problem. I got the same error message.
My Env: gcloud v274.0.0, Windows 7
First, I re-installed Google SDK, and changed my path to \Google\CloudSDK\.
Second, I got this message
"\Google\CloudSDK\google-cloud-sdk\bin..\lib\gcloud.py" init" was unexpected at this time."
So I tried to use cd command to specific directory where gcloud.py is exist.
Finally, I found the path: \Google\CloudSDK\google-cloud-sdk\lib, and it works.
Hope it can help you, too.
The problem, or rather bug within the installer, is that you are using a directory that contains spaces within it. At some point of the script the space causes the command to be split up incorrectly, causing the error.
I had the same message and fixed it by re-installing the Google Cloud SDK in a directory without spaces (c:\Google\CloudSDK)

Termux says "'Bad Interpreter: No such file or directory"

I have a problem and hope someone can help me. I am currently trying to write a script for Termux or Termux:Task. My script currently looks like this:
#!/data/data/com.termux/files/usr/bin/bash
cd /./sdcard/www/public/
wp post list sleep 5
Every time I load the script I get the following error message:
/data/data/com.termux/files/usr/bin/wp: /usr/bin/env: bad interpreter: No such file or directory.
I've been looking for a solution to my problem for hours, unfortunately without success.
I am using an extension for Termux called "WordPress CLI". When I start termux and enter the commands individually, everything works. But as soon as I write the commands into a sh script and start it doesn't work anymore. :(
Can anyone help me?
Thanks a lot
This is simple error you can fix it by replacing !/data/data/com.termux/files/usr/bin/bash. With #!/data/data/com.termux/files/usr/bin/bash
Please tell if you get error again
Try with #!/usr/bin/env bash in the shebang line.
Termux-exec allows you to execute scripts with shebangs for traditional Unix file structures. So shebangs like #!/bin/sh and #!/usr/bin/env python should be able to run without termux-fix-shebang.
From https://wiki.termux.com/wiki/Termux-exec
According to doc:
Why do I keep getting a '/bin/sh bad interpreter' error?
This error is thrown due to access script interpreter at nonexistent
location.
Termux does not have common directories like /bin, /sbin, /usr/bin at
their standard place. There is an exception for certain devices where
/bin is a symbolic link to /system/bin, but that does not make a
difference.
Interpreters should be accessed at this directory only:
/data/data/com.termux/files/usr/bin
There are three ways to fix this:
Install termux-exec by using pkg install termux-exec. It won’t affect the current session, but after a restart should work without
any setup. Not needed if your Termux is up to date. If still not
working, try the next workaround.
Use command termux-fix-shebang to fix the shebang line of specified file.
Use termux-chroot from package proot to setup a chroot environment mimicking a normal Linux file system in Termux.
termux-fix-shebang my_script.py of second method work for me, which it modify the shebang(first line of my_script.py) from #!/usr/bin/env python to #!/data/data/com.termux/files/usr/bin/env python. Since /usr/bin/ is not exist in Android, that's why it throws the error /usr/bin/env: bad interpreter: No such file or directory. The other solution is run with python my_script.py, neither of my_script.py nor ./my_script.py.
In my test, termux-exec of the first method only work if I added correct shebang in main script(child OR child of child script no need) and ran command export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so.
And for the issue of this question, error shows /usr/bin/env in the middle with /data/data/com.termux/files/usr/bin/wp even though the shebang of script #!/data/data/com.termux/files/usr/bin/bash looks ok, it means that wp command (located at /data/data/com.termux/files/usr/bin/wp) used inside the script contains shebang #!/usr/bin/env wp and should modify it to #!/data/data/com.termux/files/usr/bin/env wp too. termux-exec of first method should fix this specific case too(already has correct shebang in main script).

Pycharm background tasks taking forever

I am new to pycharm and I am having trouble to run a simple file which is just to import pandas. I am having following issues:
Whenever, I open the project, "Scanning files to index" takes
forever.
I can see that in indexing, it is using packages/files from
Anaconda2 and that is why it takes forever for my program to run.
I have already tried to make certain folder "Excluded" as described here PyCharm 4.0.5 hangs on 'scanning files to index' background task
I have also deleted the "Caches" folder as described here Intelli J IDEA takes forever to update indices
Pycharm Layout
Pycharm indexes your python environment as well as your project folders. This is normal when first changing either of these. If it occurs more frequently:
View the end of the log that #Pavel mentioned in Help | Show Log in Explorer.
Replicate the command that is stalling the scan and fix any errors.
In my case the package scanning stalled with a vague [y/N] as shown
here. Searching the log I found the following conda.exe command:
Command line: C:\Users\<User>\anaconda3\Scripts\conda.exe list -p C:/Users/<User>/anaconda3/envs/py38 -e
Running this on the command line gave me a more detailed description of my environment error and how to fix it.

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).

post install dependencies order in spec files

Is it possible to post install Requires dependecies in a spec file on Centos /RHEL 7?
I tried Requires: somepackage = 1.0.0.0
The problem is that I need to run a script prior to the dependencies being installed.
I tried to run that in the %pre section but it appears that it's not executed before the requires' %pre section is run and failing due to a missing license file.
The spec file looks like this:
Name: MyClient
Requires: MyServerPackage = 1.0.0.0
%pre
echo "Write license that is needed by MyServerPackage prior to install" > /tmp/mylicense
The problem is that I get an error: %pre(MyServerPackage) scriptles failed, exit status 1
Because the /tmp/mylicense is not there at the time MyServerPackages %pre script runs.
I've also tried to add a package called mylicense and adding a PreReq: mylicense. But no matter what I try I get that error from the check in MyServerPackage %pre.
I need to run a script prior to the dependencies being installed.
That's impossible; the dependency might have been installed two years ago, for all you know.
To answer where I think you're going, you can specify that something is required for a specific section with:
Requires: MyServerPackage
Requires(pre,preun): MyServerPackage
This would tell it (line 1) that to be installed, MyServerPackage should always be there. Then line 2 explicitly says it should be there before installing or attempting to uninstall this package if you're installing them at the same time. This is useful if, for example, the other package sets up a user name, etc.