Skip to content

Instantly share code, notes, and snippets.

View singhai0's full-sized avatar
😩
EHOSTUNREACH

Mridul Singhai singhai0

😩
EHOSTUNREACH
  • San Francisco, CA
View GitHub Profile
@singhai0
singhai0 / addtogoodreads.js
Last active December 11, 2017 04:41
Bookmarklet to open Goodreads listing for an Amazon book (in the same tab/window).
javascript:%20var%20array%20=%20document.URL.match(/amazon%5C.(.*?)%5C/.*?%5C/.*?%5C/(.%7B10%7D)/);%20if%20(array%20==%20null)%20%7B%20alert('Sorry,%20this%20doesn%5C't%20appear%20to%20be%20an%20Amazon%20book%20page.');%20%7D%20else%20%7B%20var%20x%20=%20window.location.replace('https://www.goodreads.com/review/isbn/'+%20array%5B2%5D%20+%20'?tld='%20+%20array%5B1%5D%20+%20'&from=bm',%20'add_review');%20x.focus();%20%7D
@singhai0
singhai0 / matplotlib-basemap-python3x-quakes.md
Created August 22, 2018 19:54 — forked from dannguyen/matplotlib-basemap-python3x-quakes.md
How to use matplotlib's basemap and Python 3.x to plot earthquake data on a world map

Mapping earthquakes in Python 3.x using matplotlib and matplotlib's basemap

(with a big assist from Anaconda)

I currently use Python for nearly all of my data science and wrangling work these days but usually find myself switching to R to visualize data using ggplot2. This is due in part to ggplot2's general excellence, but also because I had a lot of trouble learning Python's most popular viz library, matplotlib on my own...its homepage is decent enough...but its variety of plotting APIs (--pylab? OOP? %matplotlib???) has led to widely differing examples and best practices among the many online matplotlib guides (not dissimilar to the general problem of trying to practice either Python 2.x or 3.x).

That changed yesterday when I stumbled across [Nicolas P. Rougier's beautifully designed and com

@singhai0
singhai0 / stashbox.sh
Created March 27, 2019 22:21
See list of git stashed changes
function stashbox() {
local branch_name=$(git stash list | fzf --ansi -m --preview "echo {} | cut -d':' -f1 | xargs -I % sh -c 'git stash show --color=always % | less -R'")
if [[ $branch_name ]]; then
echo $branch_name | cut -d':' -f1| xargs git stash pop
fi
}
Courtesy: https://github.com/Brantron