Using vim-go, gocode and godep doesn't work together - vim

I am using YCM, installing with this option --gocode-completer.
After having started Vim, I see the gocode daemon :
$ ps -ef | grep gocode
501 53255 1 0 4:36PM ?? 0:00.03 /Users/yamo/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/go/../../../third_party/gocode/gocode -s -sock unix -addr localhost:37373
Completion works well on a built-ins (like fmt) but not on a dependency in GoDeps.
gocode displays the following message
: Gocode returned empty JSON response
Nevertheless, godep seems have been correctly detected
:GoPath displays
/Users/yamo/Projects/.go/src/github.com/YannMoisan/openshift-skeleton/Godeps/_workspace:/Users/yamo/Projects/.go/vendor/:/Users/yamo/Projects/.go
Any idea to fix that ?

Related

Mess with response Values: php->system->bash->python3

I'm in trouble with response Values of a phyton script (face_detection).
If I run it directly in the console, everything works pretty well.
If I run it as Part of a shell script, no response apear.
I already checked:
1.) image and scripts are usable by user www-data (at the end it should run as system-request from php). I checked it by sudo -u www-data ..
2.) Also also checked a much simpler command ("ls -l $1"), which brings the expected reponse. So only the python script doesnt work (as sub from bash script).
Now, I have NO Idea what else may be wrong in my code. Any Help would be very apreciated!
Regards ReneĀ“
Some Background info:
Ubuntu 14.4, Kernel 3.13.0-24-generic
PHP 5.5.9-1ubuntu4.26
GNU bash, version 4.3.8(1)-release
face_recognise (https://github.com/ageitgey/face_recognition) V 1.2.3
on terminal:
/usr/local/bin/face_detection /var/www/1545249278.jpg
response is:
/var/www/1545249278.jpg,166,879,701,344 (= correct)
via bash-script:
#!/bin/bash
facePosition=`/bin/bash -c \"/usr/bin/python3 /usr/local/bin/face_detection $1\"`
printf $facePosition
response is: (None/empty = wrong)
I also checked this variations:
facePosition=`/bin/bash -c \"/usr/local/bin/face_detection $1 | /usr/bin/cut -d ',' -f2\"`
facePosition=`/bin/bash -c \"/usr/bin/python3 /usr/local/bin/face_detection $1\"`
facePosition=`env python3 /usr/local/bin/face_detection $1`

Process Id of Chomium-browser not showing in terminal

I am writing a bash script and I need to kill any browser running at the time of script execution. For that I want the process id of every browser running in the background. I tried all the following, but nothing worked. See this
pidof chromium
pidof chromium-browser
pgrep chromium-browser
ps -A | grep chromium-browser
ps -aux | grep chromium-browser | grep pid
However, See this . It worked for firefox browser. Can Anyone figure out If it's something wrong with command or Chromium-browser itself. Also Can anyone tell any other method to get the process id. I shall try that out by the time.
You can try the following piece of script to list all pids of processes containing chromium-browser in their command name :
ps -aux | grep chromium-browser | tr -s ' ' | cut -d ' ' -f 2
Your other commands didn't work because the process running for chromium-browser is /usr/lib/chromium-browser/chromium-browser (at least for me on xubuntu). You can check the real process by typing ps -aux.
Note: weirdly enough, pgrep chromium-browser doesn't return anything, but pgrep chromium and pgrep chromium-browse work just fine.
pgrep -f chromium-browser is also good
Have similar issue. The reason for this is that executable file named chrome. (I'm using chromium via snap on Ubuntu 18.04)
/snap/chromium/861/usr/lib/chromium-browser/chrome --type=renderer --field-trial-handle=17044127674507841828,2715256006050366173,131072 --lang=en-US --extension-process --enable-auto-reload --num-raster-threads=4 --enable-main-frame-before-activation --service-request-channel-token=10676003778996199464 --renderer-client-id=7 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100,v8_natives_data:101
So, use chrome for you query.
Or if you'd like to use chromium-browser you need to use additional match options, like pgrep -f.

SNMP Traphandle not working

This is my first time working with SNMP, but after reading the SNMP pages I'm still having trouble getting a simple shell script to run when receiving a trap.
My /etc/snmp/snmptrapd.conf file looks like this:
# Example configuration file for snmptrapd
#
# No traps are handled by default, you must edit this file!
#
disableAuthorization yes
authCommunity log,execute,net public
# the generic traps
traphandle default /usr/local/bin/snmptrapd.sh
The snmptrapd.sh script just says "hello".
#!/bin/sh
echo "hello"
The script is executable and runs when executed independently:
> /usr/local/bin/snmptrapd.sh
hello
The snmptrapd is running as a background process:
> ps -ef | grep snmp
root 29477 1 0 14:49 ? 00:00:00 /usr/sbin/snmptrapd -Lsd -p /var/run/snmptrapd.pid -Cc /etc/snmp/snmptrapd.conf
And yet when I send a trap locally using snmptrap nothing happens:
> snmptrap -v 2c -c public localhost "" NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification netSnmpExampleHeartbeatRate i 123456
>
Now it seems that the trap does get logged, because the system log file (/var/log/messages) has the following entry:
Aug 8 15:46:10 <server_name> snmptrapd[29477]: 2017-08-08 15:46:10 localhost
[UDP: [127.0.0.1]:44928->[127.0.0.1]]:#012DISMAN-EVENT-MIB::sysUpTimeInstance =
Timeticks: (1338382434) 154 days, 21:43:44.34#011SNMPv2-MIB::snmpTrapOID.0 =
OID: NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification#011NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatRate
= INTEGER: 123456
As far as I can see everything is set up correctly. If so, why is the trap handle not working and how can one check why the trap doesn't trigger the script?
Thanks in advance.
EDIT: When I added the -Ci option to the snmptrapd command line options I got the following error:
No log handling enabled - turning on stderr logging
: Unknown Object Identifier (Sub-id not found: (top) -> )
OK, so after looking around some more I found the answer.
The reason that we are not seeing the output is because snmptrapd is being run as a daemon and doesn't send its standard output to the console. One can replace this with
echo "hello" > $HOME/output.txt
and the word 'hello' appears in the output.txt file.
See also http://www.linuxquestions.org/questions/linux-newbie-8/net-snmp-trap-handling-4175420577/
and
https://superuser.com/questions/823435/where-to-log-stdout-and-stderr-of-a-daemon

How to kill program running in background in ubuntu?

I'm working on MINI2440 and building a custom OS for it using buildroot, but for testing purpose I'm using OS downloaded from official website.
So the problem is, I'm using usbpush to push OS images in MINI2440 through USB, but it popups the message when I enter below commond
sudo ./usbpush supervivi-128M 0x30008000
Unable to claim usb interface 1 of device: could not claim interface 0: Device or resource busy
I don't understand one concept that, whenever I assign executable permission to usbpush, it runs automatically in background. It's clearly seen below
ps -ef | grep usb*
silicod+ 2431 2207 0 10:25 pts/10 00:00:00 grep --color=auto usbpush
I tried to kill using
sudo kill -9 2431
But it creates new pid and again run itsellf in background. I tried googling but nothing works for me.
=============================================================
Well, I got my solution. I don't know what is the problem with my usbpush tool, but I downloaded another tool and it works very well. Here is the link to that tool , may it help someone
Friendly_ARM_Mini2440_USBPUSH
Cheers....!
lovely ;-)
well I guess it is actually not running..
ps -ef will give you details about all running processes
grep usb* - (loose the *) will find any lines containing usb
the way unix/linux does it is that grep gets started first and then the "|" connects output of ps -ef to grep's input
so what you are finding is the grep command itself
what you want is ps -ef | grep -v grep | grep usb - this will work unless your "usb" command is something like grepusb or usbgrep or the line contains grep..

Suppress warning give in ps command output

When I run the ps command i get a warning saying "Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ"
How do i suppress this warning? Is there some system setting that i must do for this. The command that i fire is :
[root#localhost home]# ps -aux | grep "curl -s -o Test"
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root 4856 0.0 0.0 4044 672 pts/0 S+ 07:20 0:00 grep curl -s -o Test
[root#localhost home]#
Note that I have to fire the exact same command as above. That is why i am looking for some system setting that will suppress the warning.
From the FAQ:
Why does "ps -aux" complain about a bogus '-'?
According to the POSIX and UNIX standards, the above command asks to display
all processes with a TTY (generally the commands users are running) plus all
processes owned by a user named "x". If that user doesn't exist, then ps will
assume you really meant "ps aux". The warning is given to gently break you of a
habit that will cause you trouble if a user named "x" were created.
On my system, where a user x does not exist, I get no warning message. Therefore one can surmise that, on your system, a user named x exists.
If you can remove user x you can probably get the warning to go away. If not, you are stuck with the warning message.
Try:
ps -aux | grep "curl -s -o Test" 2> /dev/null
Or a variant of that.

Resources