Skip to content

Instantly share code, notes, and snippets.

View rmcgibbo's full-sized avatar

Robert T. McGibbon rmcgibbo

View GitHub Profile
@SuperSandro2000
SuperSandro2000 / prepare-commit-msg.sh
Last active November 12, 2023 23:13
prepare commit message for nixpkgs. put into .git/hooks/prepare-commit-msg
#!/usr/bin/env bash
# shellcheck disable=SC2034
COMMIT_MSG_FILE=$1 # file which contains the commmit message
# shellcheck disable=SC2034
COMMIT_SOURCE=$2 # eg commit
# shellcheck disable=SC2034
SHA1=$3 # eg head
perl -i -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
@AlexandreAbraham
AlexandreAbraham / unsupervised_alt.py
Last active February 5, 2023 23:00
These are two implementations of the silhouette score. They are compatible with the scikit learn implementation but offers different drawbacks in term of complexity and memory usage. The slow version needs no memory but is painfully slow and should, I think, not be used. The second one is based on a block strategy: distance between samples and c…
""" Unsupervised evaluation metrics. """
# License: BSD Style.
from itertools import combinations
import numpy as np
from sklearn.utils import check_random_state
from sklearn.metrics.pairwise import distance_metrics
from sklearn.metrics.pairwise import pairwise_distances
@rmcgibbo
rmcgibbo / install.sh
Last active October 9, 2015 03:48
Install Python / numpy / scipy / ipython / matplotlib / umfpack / pytables from source
#!/bin/bash
# =================================================================
# Install a full scientific python stack from source, for Ubuntu, with
# python 2.7.3 (tested on a totally fresh Ubuntu12.04-amd64). Requires
# sudo for apt-getting dependencies like libatlas, Tk, etc
# =================================================================
# packages pulled from PyPI are currently
# scipy 0.10.1
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@DNNX
DNNX / glob.bat
Created December 15, 2011 14:18
Glob expanding: Windows vs Unix vs PowerShell
SETLOCAL ENABLEDELAYEDEXPANSION
SET FILES=
FOR %%A IN (%1\*.gz) DO ( SET FILES=!FILES! %%A )
echo !FILES!
@hannes-brt
hannes-brt / pyximport_numpy.py
Created December 28, 2010 13:08
Setup pyximport to include the numpy headers
import pyximport
import numpy as np
pyximport.install(setup_args={'include_dirs': np.get_include()})