How to add copy button in .rst file or Read The Docs (RTD) - restructuredtext

This is the duplicate question but i follow the steps as the link, and the code-block still didnt show up the button icon as expected.
which steps did i miss?
Install
pip install sphinx-copybutton
Declare it in the conf.py
extensions = [
...
'sphinx_copybutton'
...
]
No copy icon
install via pip
Edit: this is the full conf.py
conf.py

Related

How to set default folder in JupyterLab file browser?

I was wondering if there is a way to set a default folder every time I open JupyterLab. Is there any command I can run through Anaconda PowerShell Prompt? Or a JSON property I can modify in settings tab? Thanks in advance!
If you want to open specific file in directory a, say a/notebook.ipynb but then navigate the file browser to directory b, relative to the root directory, you can use file-browser-path query in the navigation URL (documented here):
http(s)://<server:port>/<lab-location>/lab/tree/a/notebook.ipynb?file-browser-path=/b
You can use this method from command line thanks to LabApp.default_url traitlet:
jupyter-lab --LabApp.default_url='/lab/tree/a/notebook.ipynb?file-browser-path=/b'
You can skip the opening specific file part:
jupyter-lab --LabApp.default_url='/lab?file-browser-path=/b'
If you want to change the root directory, please see this answer which explains how to do so with ServerApp.root_dir traitlet (in older versions of Notebook<7.0 and JupyterLab<3.0 used to be named NotebookApp.notebook_dir). Again, you can use it from command line, and even specify an absolute path:
jupyter-lab --ServerApp.root_dir='/home/user/project/'
# or on Windows say:
# jupyter-lab --ServerApp.root_dir='C/users/user/project/'
You can combine the two approaches, e.g.:
jupyter-lab --ServerApp.root_dir='/home/user/project/' --LabApp.default_url='/lab?file-browser-path=/project_subdirectory'
If you want to persist the changes (for either default URL or root dir), see the previously linked answer which details how to persist configuration.
Follow the answer . Just edit the alias alias my_jupn='source /home/$USER/anaconda3/bin/activate && conda activate MyPy38 && jupyter-notebook --notebook-dir=/home/$USER/Documents/Jupyter_Notebook'
and for JupyterLab alias my_jupl='source /home/$USER/anaconda3/bin/activate && conda activate MyPy38 && jupyter-lab --notebook-dir=/home/$USER/Documents/Jupyter_Notebook'
N.B. Here MyPy38 is your active environment name. and if any error occurs then change $USER to your UserName. Lastly, /home/$USER/Documents/Jupyter_Notebook will be change according to your choice.
According to the jupyter.org:
I configured like this.
Terminal command active your envirnment by conda activate Your_env_name and then jupyter lab --generate-config. jupyter_lab_config.py should be created in dir /home/$USER/.jupyter directory.
Find
# c.LabApp.app_settings_dir = '' and uncomment.
Then give your directory like this.
c.LabApp.app_settings_dir = '/home/$USER/Documents/Jupyter_Notebook'
Similar for jupyter notebook. jupyter notebook --generate-config and then nu-comment and edit like c.NotebookApp.notebook_dir = '/home/UserName/Documents/Jupyter_Notebook'
**NB: /home/$USER/Documents/Jupyter_Notebook is my changed default dir. Change it according to your need. **
The command
jupyter notebook --generate-config
will create a config file.
The path to this file is displayed in your terminal or PowerShell.
Set the desired folder path as the string c.ServerApp.root_dir in this file and make sure you uncomment the line after you set the string.
Windows users will have to use double backslash in paths, e.g.:
c.ServerApp.root_dir = 'C:\\YOUR\\PATH'

Vim claims Eclim’s ProjectCreate is not an editor command

I followed eclim’s installation instructions, but when getting started I can’t even create a project :
:ProjectCreate /path/to/project
E492: Not an editor command: ProjectCreate
What’s wrong ?
Did you use the eclim installer suggestion to install vimfiles in ~/.vim/bundle/eclim ? By default (at least on Debian) vim won’t look into this directory. You have to move eclim’s vimfiles (directories eclim and plugins) directly into ~/.vim/ (merge plugins if it already exists).
Alternatively, I didn’t test it but the "build from source" tutorial suggests to
create a user.properties file at the eclim source root and put all your properties in there:
$ vim user.properties
eclipse.home=/opt/eclipse
eclipse.local=${user.home}/.eclipse/org.eclipse.platform_<version>
vim.files=${user.home}/.vim/bundle/eclim

Fontello - how to add fonts to existing project?

How can I add more fonts to an existing Fontello directory?
I know I can re-import my config.json into the Fontello website, then select new fonts, then re-download the config file.
This updates the config file but not, of course, the actual .css files.
So short of downloading the entire ZIP again (which is annoying as it has a different random suffix in the filename each time), how can this be done?
I've also tried via CLI but there's basically no documentation on how this might be achieved, if it even can.
cd /path/to/my/fontello/dir
npm run-script build
After some more digging I found a few ways to do this. My preference was from CLI. Although the Fontello-CLI docs on Github are bare, Fontello's own docs discuss updating projects via CLI.
Install the Node package manager (NPM)
Open a command line interface (CMD)
Install the Fontello-CLI via npm install fontello-cli -g
cd to the directory your Fontello folder lives in - NOT the directory itself
Run fontello-cli --config <fontello-dir-name>/config.json open to open your project on the Fontello website. Your project's existing fonts will already be selected. You can now add more fonts.
When done, go back to CMD and run fontello-cli --config {fontello-dir-name}/config.json install - this will update your project with the revised choices.
Voila!

Configure atom package options from command line?

I'm writing a shell script I can run on a new machine to install my apps, set preferences, arrange dock, and add homebrew packages, and I'd like to be able to configure atom packages within the script instead of manually. Is this possible?
Edit: Also I'd like to change the theme from command line, is that possible?
cd ~/.atom
touch init.coffee
echo "atom.config.set('core.themes', ['THEME_HERE', 'SYNTAX_THEME_HERE'])" >> init.coffee
Atom configuration settings are stored as CSON text in config.cson in the .atom directory. So, for example, if you ran
atom.config.set('core.themes', ['THEME_HERE', 'SYNTAX_THEME_HERE'])
from inside Atom, in the config.cson file, you would see:
"*":
core:
themes: [
"THEME_HERE"
"SYNTAX_THEME_HERE"
]
So, you can write directly to this file from your shell script to configure Atom. You can also change config.cson to config.json and use JSON (instead of CSON) to configure the editor, which can make it easier to use things like jq to work with the file.

How can I fix not working oh-my-zsh plugins

I've just discovered oh-my-zsh, but I can't get it to work. While themes work just perfectly, plugins do not. I have some plugins selected, eg. macports, but neither I get port command completion nor do appropriate aliases work. Here's my ~/.zshrc:
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
export ZSH_THEME="steeef"
# Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# export DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# export DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# export DISABLE_AUTO_TITLE="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git osx github macports textmate svn)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
export
PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin/:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/opt/local/bin:/opt/local/sbin
textmate and osx plugins also do not seem to work. zsh complains about unknown command and stops. git and svn have some basic completion but I'm not sure whether it's done by plugin or just a normal zsh completion. Do I have to export something to use those plugins? Or if not, what to do to have that fixed?
Make sure that you define your plugins variable before you initialize zsh:
plugins=(git wd)
export ZSH=/home/<user>/.oh-my-zsh
source $ZSH/oh-my-zsh.sh
I got bitten by this.
What happened is you did a manual install and the instructions for the manual install don't mention that you need to set the PATH yourself.
So you end up with the default PATH. The source for the automatic setup code copies your current path and appends it to the .zshrc, which isn't enough if you depend on non-standard PATH entries (e.g. you run Homebrew on a Mac).
So the fix is simple:
Fire up your old shell and its configuration file and then copy and paste the value of $PATH into the top of your ~/.zshrc file.
Ciao!
I had the same problem just now! There was a package called grml-zsh-config installed in my Archlinux. I removed this package and oh-my-zsh themes started to work.
In my case, in ~/.zshrc I had repeated plugins variable
plugins=(git)
.
.
.
plugins=(git autojump zsh-syntax-highlighting zsh-autosuggestions)
Check to see if this is the case with you because with this only your git plugin will be used.
Remove the first plugins variable and it should work.
I was running into this with the kubectl plugin.
Looking at the contents of ~/.oh-my-zsh/plugins/kubectl/kubectl.plugin.zsh I realized I didn't have the same content as what was on the github repo. Manually updating the file with the contents from the oh-my-zsh repo helped and the plugin started to work. Guess I had to update my oh-my-zsh installation to get the latest plugin content but this worked for me.
In my case,I forgot to add custom plugin name to .zshrc file:
plugins=(customPluginName)
And reload .zshrc:
source ~/.zshrc
make sure the folders of the plugins are located in the ~/.oh-my-zsh/custom/plugins folder. I will advise you are on this directory when you git clone the plugins.
Secondly ensure that you seperate the list of plugins in the ~/.zshrc file with a single space NOT comma.
.
.
.
plugin = (git zsh-syntax-highlighting)
.
.
.
So in the above example, two plugins are added there: git and zsh-syntax-highlighting.
If your .zshrc has this at the top
export ZSH="~/.oh-my-zsh"
try to changing it to:
export ZSH="$HOME/.oh-my-zsh"
Try manually source your plugins like this:
source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
Full .zshrc example:
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(zsh-autosuggestions)
source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

Resources