Skip to content

Instantly share code, notes, and snippets.

View guanyilun's full-sized avatar

Yilun Guan guanyilun

  • Toronto
View GitHub Profile
@guanyilun
guanyilun / colorbar.py
Last active April 17, 2021 20:09
Colorbar example
"""functions to add colorbar with respect to a known axis, without
specifying the coordinates / size explicitly.
Examples:
To add a colorbar on top of a figure with a size 5% of the image,
cax = add_colorbar(ax, size="5%", loc='top')
This returns the colorbar axis that can pass to make a colorbar
fig.colorbar(im, cax=cax)
@guanyilun
guanyilun / arxiv
Created November 5, 2018 17:54
arxiv-cli
#!/bin/bash
abstract=$(curl -sS https://arxiv.org/abs/$1 | grep Abstract: -A 1000 | grep \<\/blockquote\> -B 1000 | sed -e 's/\<span.*span\> /Abstract: /' -e '/blockquote/d')
echo $abstract
echo Download pdf? [y/n]
read choice
if [ "$choice" == "y" ]; then
curl -O $(echo https://arxiv.org/pdf/$1.pdf)
fi