Skip to content

Instantly share code, notes, and snippets.

View matsen's full-sized avatar

Erick Matsen matsen

View GitHub Profile
#!/bin/sh
set -e
set -o
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y \
autojump \
@matsen
matsen / md-nb-diffs.md
Last active February 22, 2021 21:44 — forked from iamlemec/nb2md
Markdown diffs for jupyter notebooks.

For sane jupyter notebook diffs

  • Install the nbconvert package, though you probably already have it if you are using jupyter.
  • Put the nb2md script below in your path and make executable
  • Add the following to your .gitattributes file, which can be in your home directory (use nb2md for all projects) or in the root of your project:
*.ipynb diff=nb2md
  • Run
@matsen
matsen / refresh-ssh-in-tmux.sh
Created January 3, 2020 14:42
A shell command to refresh SSH_AUTH_SOCK in a running tmux session
r () {
if [[ -n $TMUX ]]
then
NEW_SSH_AUTH_SOCK=`tmux showenv|grep "^SSH_AUTH_SOCK"|cut -d = -f 2`
if [[ -n $NEW_SSH_AUTH_SOCK ]] && [[ -S $NEW_SSH_AUTH_SOCK ]]
then
echo "New auth sock: $NEW_SSH_AUTH_SOCK"
SSH_AUTH_SOCK=$NEW_SSH_AUTH_SOCK
fi
NEW_DISPLAY=`tmux showenv|grep "^DISPLAY"|cut -d = -f 2`
@matsen
matsen / svg2tiff
Created December 12, 2012 01:05
A script to convert SVG to a TIFF acceptable to PLOS
#!/bin/sh
# Convert all arguments (assumed SVG) to a TIFF acceptable to PLOS
# Requires Inkscape and ImageMagick 6.8 (doesn't work with 6.6.9)
for i in $@; do
BN=$(basename $i .svg)
inkscape --without-gui --export-png="$BN.png" --export-dpi 300 $i
convert -compress LZW -alpha remove $BN.png $BN.tiff
mogrify -alpha off $BN.tiff