How to install nano using GitBash in Windows 10? - github

I am trying to install nano editor. From all the previous posts, I am stuck on path. What is path? How do I fix put my path?
I have:
$ mv nano ~/path/to/git/share
$ nano abc
bash: nano: command not found

You can add it via chocolatey.
choco install nano

PATH is the environment variable which is used to locate an executable you want to run.
See "How to permanently set $PATH on Linux?": you can add the folder where nano is in your .bashrc (which you can create directly under %USERPROFILE%, used by Git bash as $HOME)
Add to ~/.bashrc:
export PATH=$PATH:~/path/to/git/share
Then type
source ~/.bashrc
If you don't want to add it to your PATH, you can follow this step-by-step procedure, which does include the installation of nano-git-0d9a7347243.exe.

If your ultimate goal is to have and use nano on Windows 10, you can download the nano installer from here and just install the .msi file the usual Windows way. No manual path configurations required.

Related

How to view code coverage as html in Windows?

I did flutter test --coverage
A lcov.info was generated under coverage
I want to convert this into html but I don't find a tool for Windows.
On linux, you just do:
sudo apt-get update -qq -y
sudo apt-get install lcov -y
Then you do
genhtml coverage/lcov.info -o coverage/html
I am on Windows and
'genhtml' is not recognized as an internal or external command,
operable program or batch file.
Ok I found it. I will leave the anwser here in case it maybe helpful for anyone.
Actually genhtml is a perl script. If you are have git bash installed, you should have perl already. Try where perl on the cmd and it will show you the path.
For me it was at C:\Program Files\Git\usr\bin\perl.exe
Now create a file called genhtml.perl inside your flutter project root directory. (Make sure to .gitignore it)
Then in the file, copy and paste the content this https://raw.githubusercontent.com/valbok/lcov/master/genhtml.perl
Finally open git bash and run $ ./genhtml.perl ./coverage/lcov.info -o coverage/html .
Check You are done html files at coverage/html.
On android studio, select index.html then CTRL+SHIFT+C to copy the file path.
Open Chrome and on the url bar add file:///+CTRL+V. Tap enter. You are done.
PS : Who so ever is facing an error like No common filename prefix found! or some other issue, they can try replacing content of genhtml.perl file from below link.
https://raw.githubusercontent.com/linux-test-project/lcov/master/bin/genhtml

Vim in Jupyter Notebook

# You may need the following to create the directoy
$ mkdir -p $(jupyter --data-dir)/nbextensions
# Now clone the repository
$ cd $(jupyter --data-dir)/nbextensions
$ git clone https://github.com/lambdalisue/jupyter-vim-binding vim_binding
$ chmod -R go-w vim_binding
I found this installation guide to include vim in Jupyter. But I don't understand the above installation step.
I am using Windows 10 and Chrome. Where should I run those code? Anaconda prompt or cmd?
Those are instructions for a linux environment. You can use either cygwin or the Windows Linux Subsystem (WSL).

Actions on Google - Mac gactions won't run

I am trying to set up the Actions sdk as described here:
https://developers.google.com/actions/sdk
I downloaded gactions for a Mac 64-bit machine. If I try to open the file, it opens as text. When I am in the folder containing gactions, I try to run gactions init and get the response:
-bash: gactions: command not found
Any thoughts?
Try this:
Download Google gactions cli from gaction CLI
On Mac and Linux, to make the binary executable run from terminal:
$ cd folder_with_gactions
$ chmod +x gactions
Execute gactions
$ cd folder_with_gactions
$ ./gactions init
Also, you may find this tutorial interesting if you are trying to create an action in Google Home : How to create a custom private Google Home Action with API.AI and Google App Engine. In STEP 8 you can find an example of gactions.
If you have already setup google-cloud-sdk correctly, then you can drop the gactions file into the google-cloud-sdk/bin folder. Alternatively, you can add a path to bash directly to the folder you have gactions.
To add the gactions command CLI location to the System Paths:
Use “Go to the Folder” option of Finder, to search “~/.bash_profile”
Open the File “~/.bash_profile”
 in edit mode and add the following command, at the top the file, Save and Close.
export PATH="$PATH:$HOME/gactionsCLI"
Note: Above path refers to the folder which contains the executable
file “Unix Executable”
Restart the Terminal and try the commands
Download gactions
copy downloaded gactions and put into a local Project folder
and then go to your project directory cd "project directory"
run following commands :
$ chmod +x gactions
$ ./gactions init
it will create action.json into your folder
Ensure you run chmod +x gactions to make the binary executable
Copy the binary executable into the project directory
Run ./gactions init from the terminal/command line

Using a sort of portable JDK on centOs

This is the first time that I use linux in my life, I'm a little bit strugling.
Permissions, user, folder structure, it's a lot to take in.
Everything I did, I did with the ATH user which is a regular non sudoer user.
I got Centos minimal and put it in a VM
then I extracted the linux tar.gz jdk in /home/ath/monitoring/jdk1.8.0_70_linux64
And I added this to a sh script, this sh script call other sh script
I want them to only use this jdk
below #!/bin/sh I added
export JAVA_HOME=/home/ath/monitoring/jdk1.8.0_70_linux64
However when I launch the script I get :
Which : no java in (/usr/local/bin:/usr/bin:usr/local/sbin:/usr/sbin:/home/ath.local/bin:/home/ath/bin)
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME
What am I doing wrong?
Thanks
ps : I used (logged as root) chmod +x /home/ath/monitoring/elasticsearch/bin/elasticsearch/bin/elasticsearch.sh
on the sh script otherwhise it would not run
So I also had to add this line because the script was looking into PATH :
export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH
And I had to render all the file in jdk/bin executable running this inside
chmod a+x *
I don't get it tho, each time I'm getting a software I have to manually go and chmod every file that need it? quite bothersome.

virtualenvwrapper commands aren't working

tow-81-235:Projects pessimisticoptimism$ mkvirtualenv development
-bash: mkvirtualenv: command not found
tow-81-235:Projects pessimisticoptimism$ sudo pip install virtualenvwrapper
Password:
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Python/2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /Library/Python/2.7/site-packages (from virtualenvwrapper)
Cleaning up...
tow-81-235:Projects pessimisticoptimism$ mkvirtualenv development
-bash: mkvirtualenv: command not found
Why am I getting this error? I have virtualenv and virtualenvwrapper installed. I'd like to use mkvirtualenv and workon. I find it odd that virtualenv is working, but virtualenvwrapper isn't.
1st, ensure you're installing with sudo:
sudo pip install virtualenvwrapper
2nd, append the following lines to your .bashrc file (with nano ~/.bashrc):
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
3rd, reload your profile
source ~/.bashrc
Summary
I'm on a Mac and my answer is similar to #Ramces answer except it was with bash_profile. I just want to elaborate a little further for Mac users to be aware that there's a lot of different profiles including:
.bashrc
.bash_profile
.profile
Some files like .profile do not take precedence over .bash_profile (if it exists) and will then be ignored. If you successfully do the below steps and get a virtual env working, but then close out your terminal and 'workon command not found', then you need to setup for the correct profile. For a detailed answer, see here
Install Steps:
sudo pip install virtualenv
Installs virtualenv (allows you to separate your envrionments)
sudo pip install virtualenvwrapper
Installs virtualenvwrapper (allows you to use the 'workon' command)
nano ~/.bash_profile
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
source ~/.bash_profile
Reloads the profile. Going forward you only need step 5 (to create new environments) and step 6 (to run environments)
mkvirtualenv my_env
This creates your virtual environment (this example is with 'my_env')
workon my_env
This lets you work on a specific environment (this example is with 'my_env')
After installing the virtualenvwrapper package using pip, you also have to do some initialisation/set your preferences. See the introduction in the virtualenvwrapper docs.
Most relevant for finding the commands should be sourcing the virtualenvwrapper script into your shell. In the docs it is mentioned as
$ source /usr/local/bin/virtualenvwrapper.sh
You still have to adjust the path to your setup. My guess for your Mac would be:
$ source /Library/Python/2.7/site-packages/virtualenvwrapper.sh
Simple process
sudo apt-get install python-pip(if pip is not installed)
sudo pip install virtualenv
Create a dir to store your virtualenvs
mkdir ~/.virtualenvs
sudo pip install virtualenvwrapper
Run following command
export WORKON_HOME=~/.virtualenvs
Add virtualenvwrapper.sh to .bashrc
Add this line to the end of ~/.bashrc so that the virtualenvwrapper commands are loaded.
. /usr/local/bin/virtualenvwrapper.sh
you will find .bashrc.sh file in home directory by doing ctrl+h. if not then use find command to find .bashrc.sh "file ls -la ~/ | more"
Hit this command
source /usr/local/bin/virtualenvwrapper.sh
Hit this command
source ~/.bashrc
It sounds like you have multiple Python installations on your machine and virtualenvwrapper is not pointing to the right Python.
Find out which Python virtualenvwrapper is using. You get a hint where to look with which virtualenvwrapper.sh (In this case /usr/local/bin):
> /usr/local/bin/virtualenvwrapper.sh
If you don't get any return here make sure you use the correct pip when installing. The pip command might link to a different Python then you expect. Check your usr/local/bin directory for pip links (pip, pip2, pip2.7, pip3, pip3.5). It is easy to get system pip, pip2 and pip2.7 mixed up.
After you have found the Python location, add/update all paths in your .profile:
export WORKON_HOME=$HOME/venv
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2
source /usr/local/bin/virtualenvwrapper.sh
Finally reload your profile: source ~/.profile
I am on Mac OS X 10.9.2 and for me virtualenvwrapper.sh file was present in
/usr/local/bin/virtualenvwrapper.sh
So I simply copied this into ~/.profile file:
source /usr/local/bin/virtualenvwrapper.sh
And now my ~/.profile file looks something like this:
# MacPorts Installer addition on 2014-02-23_at_17:28:39: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
source /usr/local/bin/virtualenvwrapper.sh
And now I am able to use virtualenvwrapper commands without any issue whatsoever
Users of the Anaconda (from Continuum) distribution of Python should note that
sudo pip install virtualenvwrapper
will be anaconda-aware. So if you
which python
that should give you an idea of where to point your virtualenv in your .bashrc and/or .profile configuration files.