Skip to content

Instantly share code, notes, and snippets.

@johnmarcampbell
johnmarcampbell / precommit_notebook_clearing.bash
Last active February 19, 2021 05:25
A pre-commit hook for clearing output from jupyter notebooks
#!/bin/bash
# Find staged files | filter for notebooks | substitute spaces for newlines
notebooks=$( git diff --staged --name-only | grep .ipynb | tr '\n' ' ')
# If there are staged notebooks, clear them and re-add them
if [ -n "$notebooks" ]; then
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace $notebooks
git add $notebooks
fi
@johnmarcampbell
johnmarcampbell / caps-to-ctrl.md
Last active October 15, 2023 13:30
Create systemd service to remap caps lock to ctrl on boot
  1. Create the following three files:

/etc/systemd/system/caps-to-ctrl.service

[Service]
ExecStart=/usr/local/bin/caps-to-ctrl.sh

[Install]
WantedBy=default.target

Keybase proof

I hereby claim:

  • I am johnmarcampbell on github.
  • I am johnmarcampbell (https://keybase.io/johnmarcampbell) on keybase.
  • I have a public key whose fingerprint is 5400 68DD 5B2D F4EE 6DD9 E08F 27D6 FF43 0F2C 6E76

To claim this, I am signing this object: