This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [pts] = getpts3d(x, y, z, n) | |
%% getpts3d Select points from a 3D scatter plot by clicking on plot | |
% x - Vector of X coordinates | |
% y - Vector of Y coordinates | |
% z - Vector of Z coordinates | |
% n - Number of points needed to be selected | |
% pts - Returns a n x 3 matrix of selected points | |
h = figure; | |
scatter3(x,y,z); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
import numpy as np | |
import argparse | |
from sklearn.metrics import confusion_matrix | |
import matplotlib.pyplot as plt | |
# Put in appropraite directory so that python can import caffe | |
import caffe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From @raymondh on Twitter | |
heapq.nsmallest(k, iterable, key = lambda x: abs(x - center)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you want to keep changes of the current branch | |
grep -lr '<<<<<<<' . | xargs git checkout --ours | |
# If you want to keep the changes of the branch that is being merged | |
grep -lr '<<<<<<<' . | xargs git checkout --theirs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mapped_series = df['series'].map(lambda x: Value you want x to be mapped to] | |
mapped_series = df['series'].map(lambda x: x**2) | |
# filtered_df = df['series'].map(lambda x: True/False function] | |
filtered_df = df[df['series'].map(lambda x: len(x)>3]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls directory | cut -d'.' -f1 | xargs -n 1 -i grep {} file_to_search_in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e=document.getElementsByClassName('add'); | |
var i = 0,n = e.length; | |
function f() { | |
if(e[i].className.indexOf('active')>=0) e[i].click(); | |
i++; | |
if( i < n ){ | |
setTimeout( f, 3000 ); //Time out required for registering subscribe on the servers | |
} | |
} |