Skip to content

Instantly share code, notes, and snippets.

@smba
smba / fix_github_https_repo.sh
Created June 30, 2021 18:38 — forked from m14t/fix_github_https_repo.sh
Convert HTTPS github clones to use SSH
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi
@jakevdp
jakevdp / discrete_cmap.py
Last active January 12, 2025 13:24
Small utility to create a discrete matplotlib colormap
# By Jake VanderPlas
# License: BSD-style
import matplotlib.pyplot as plt
import numpy as np
def discrete_cmap(N, base_cmap=None):
"""Create an N-bin discrete colormap from the specified input map"""
@timm
timm / a12.py
Created May 22, 2013 20:07
Python version of non-parametric hypothesis testing using Vargha and Delaney's A12 statistic.
class Rx:
"has the nums of a treatment, its name and rank"
def __init__(i,lst):
i.rx, i.lst = lst[0], lst[1:]
i.mean = sum(i.lst)/len(i.lst)
i.rank = 0
def __repr__(i):
return 'rank #%s %s at %s'%(i.rank,i.rx,i.mean)
def a12s(lst,rev=True,enough=0.66):
@m14t
m14t / fix_github_https_repo.sh
Created July 5, 2012 21:57
Convert HTTPS github clones to use SSH
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi