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
| " TEMPLATES | |
| function! LoadTemplate() | |
| " load a template based on the file extension | |
| silent! 0r ~/.vim/skel/tmpl.%:e | |
| " Replace some placeholders | |
| %s/%FILENAME%/\=expand("%:t")/g | |
| %s/%DATE%/\=strftime("%b %d, %Y")/g | |
| " This last one deletes the placeholder |
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
| double any_op(double, double, std::function<double(double,double)>); | |
| int main() | |
| { | |
| std::function<double(double,double)> add = [](double a, double b) -> double { return a+b; }; | |
| std::function<double(double,double)> sub = [](double a, double b) -> double { return a-b; }; | |
| printf("5 + 10 = %0.2f\n", any_op(5., 10., add)); | |
| printf("5 - 10 = %0.2f\n", any_op(5., 10., sub)); |
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 numpy import array,sin,cos,cov | |
| import numpy.random as random | |
| def obs_to_xyz(obs): | |
| D,th,phi,vr,vth,vphi = tuple(obs) | |
| sth,cth = sin(th),cos(th) | |
| sphi,cphi = sin(phi),cos(phi) | |
| return [D*sth*cphi, | |
| D*sth*sphi, | |
| D*cth, |
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
| shelltitle "$ |bash" |
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
| # command prompt... HOLY SHIT MAGIC! | |
| case $TERM in | |
| screen*) | |
| SCREENTITLE='\[\ek\e\\\]\[\ek\W\e\\\]' | |
| ;; | |
| *) | |
| SCREENTITLE='' | |
| ;; | |
| esac | |
| export PS1="${SCREENTITLE}[\u@\h \W]\$ " |
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
| import b | |
| def foobag(a_number): | |
| return a_number+1 |
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
| time ssh hostname ls |
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
| # encoding: utf-8 | |
| """ | |
| A function for combining adjacent SDSS fields into one image. | |
| History | |
| ------- | |
| 2011-08-10 - Created by Dan Foreman-Mackey | |
| """ |
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
| import cPickle as pickle | |
| import numpy as np | |
| from bson.binary import Binary | |
| from pymongo.son_manipulator import SONManipulator | |
| class NumpySONManipulator(SONManipulator): | |
| def transform_incoming(self, value, collection): | |
| if isinstance(value, (list,tuple,set)): | |
| return [self.transform_incoming(item,collection) for item in value] | |
| if isinstance(value,dict): |
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
| import numpy as np | |
| class Catalog(object): | |
| def __init__(self): | |
| self.stars = [] | |
| def add_star(self, star): | |
| self.stars.append(star) | |
| @property |
OlderNewer