Skip to content

Instantly share code, notes, and snippets.

@dkapitan
Last active January 5, 2021 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkapitan/d4a6f970edb97bae9efa041b04672c35 to your computer and use it in GitHub Desktop.
Save dkapitan/d4a6f970edb97bae9efa041b04672c35 to your computer and use it in GitHub Desktop.
Migrating from OSX to Pop!_OS

Installing POP!_OS 20.10 with dual boot

Dell XPS 15 (2020)

  • disable Secure Boot
  • make bootable USB with POP!_OS using Rufus
  • Shrink Windows 10 partion to make room for POP!_OS
  • Turn RAID off and switch to AHCI. This breaks windows if you do it directly in BIOS!. You can follow the steps from this Medium article

Installed productivity apps

Tried, but ditched

  • albert as replacement for Alfred, but ditched it because it made system slow and had issues with rendering in HiDPI. Sticking to Gnome Shell with extra search providers.

Starting points

  • Stick to Gnome Shell defaults from POP!_OS 20.10
  • Use Vim
    • vscodevim for Vim emulation, with some exceptions to keep most common shortcuts
    "vim.handleKeys": {
      "<C-c>": false,
      "<C-v>": false
    }
    
    • set -o vi in zsh

Note that in Linux:

  • terminals always use CTRL+SHIFT+C/V since CTRL+ shortcuts are reserved
  • Gnome shell has reserved Super for system-wide interaction (which I like, the new POP!_OS window shortcuts are nice). But in OSX Super/CMD takes the role of CTRL.
  • CTRL is reserved for applications, e.g. CTRL+Tab to cycle through tabs in a browser

See also:

from https://github.com/adam-savard/keychron-k2-function-keys-linux

Step 1

Open a terminal window and enter the following command:

sudo nano /etc/systemd/system/keychron.service

Step 2

Paste the following into the window:

[Unit]
Description=The command to make the Keychron K2 work

[Service]
Type=oneshot
ExecStart=/bin/bash -c "echo 0 > /sys/module/hid_apple/parameters/fnmode"

[Install]
WantedBy=multi-user.target

Press ctrl+o and then ctrl+x to exit.

Step 3

In the terminal, type the following:

systemctl enable keychron

Step 4

That's it! A reboot, and you'll see that the function keys have been re-enabled.

Closing Remarks

If you want to simply drag/drop the file that you create manually in the steps provided, I have it under the scripts folder in this repo. Download it and drop it in /etc/systemd/system/, doing Step 3 at the end.

Setting up Python

Symlink system Python

Only python3 (3.8.6) is installed as system Python. Symlink

cd /usr/bin && ln -sf python3 python

We keep system Python as pyenv global and use that for day-to-day work.

Install pyenv

Follow Real Python's intro to pyenv by installing build dependencies and using the pyenv-installer.

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl

curl https://pyenv.run | bash

# Load pyenv automatically by adding
# the following to ~/.bashrc:

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Install Jupyter

Recommended to install globally.

pip install jupyter

# Two errors
ERROR: jupyterlab-pygments 0.1.2 has requirement pygments<3,>=2.4.1, but you'll have pygments 2.3.1 which is incompatible.
ERROR: nbconvert 6.0.7 has requirement pygments>=2.4.1, but you'll have pygments 2.3.1 which is incompatible.

Can't figure out how to update python3-pygments with apt so reverting to

pip install jupyterlab-pygments

and adding to .bashrc

export PATH=$HOME/.local/bin:$PATH

Install jupyter nbextensions

RISE

From a clean install, installing RISE globally should work.

pip install RISE

I got errors, but after cleaning up spurious jupyter in /usr/local/lib this worked.

jupyter-black

For jupyter-black, we follow the standard installation procedure.

jupyter nbextension install https://github.com/drillan/jupyter-black/archive/master.zip --user
jupyter nbextension enable jupyter-black-master/jupyter-black

toc2

Installing jupyter_contrib_nbextensions usual way with pip install jupyter_contrib_nbextensions doesn't work. Have installed each extension separately as follows (example for toc2)

cd ~/.local/lib/python3.8/site-packages/jupyter_contrib_nbextensions/nbextensions/toc2/
jupyter nbextension install . --user
jupyter nbextension enable toc2/main --user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment