Skip to content

A collection of dotfiles-based notebooks for use with Jupyter or VSCode for development and experimentation

Notifications You must be signed in to change notification settings

gbraad-dotfiles/notebooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dotfiles usage in notebooks

Installation

!apt-get install vim tmux powerline zsh stow
!git clone https://github.com/gbraad/dotfiles.git ~/.dotfiles
!~/.dotfiles/install.sh

or

!curl -fsSL https://dotfiles.gbraad.nl/install.sh | sh

Usage

Source inside scriptblock

%%script zsh
. ~/.dotfiles/source.sh
country

Line amd Cell magic

In a code cell execute:

from IPython.core.magic import register_line_cell_magic

@register_line_cell_magic
def mysh(line, cell=None):
    command = line
    if cell:
        command += '\n' + cell
    get_ipython().system(f"zsh -i -c '. ~/.dotfiles/source.sh; {command}'")

Line magic

%dotfiles country
"The Netherlands"

Cell magic

%%dotfiles
country
"The Netherlands"

Extension

This is only available if the .dotfiles has also stwoed ipython. This can be done as follows

%%script zsh
cd ~/.dotfiles
stow ipython

After this you can use the following in your notebook to load the extension:

$load_ext dotfiles

If for some reason you get a ModuleNotFoundError: No module named 'dotfiles', it might be that the extensions is not part of the sys.path. This can be fixed with:

import sys, os
sys.path.append(os.path.expanduser("~/.ipython/extensions"))

About

A collection of dotfiles-based notebooks for use with Jupyter or VSCode for development and experimentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published