This file contains 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
""" | |
Functions for converting dates to/from JD and MJD. Assumes dates are historical | |
dates, including the transition from the Julian calendar to the Gregorian | |
calendar in 1582. No support for proleptic Gregorian/Julian calendars. | |
:Author: Matt Davis | |
:Website: http://github.com/jiffyclub | |
""" |
This file contains 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
#!/usr/bin/env python | |
""" | |
Prepare an HTML file from SnakeViz for use as a static page. | |
This makes it so all static files are loaded from a CDN instead | |
of from the local server. | |
To get the SnakeViz HTML file run the snakeviz CLI to load a profile | |
in your browser, than save that page as an HTML file to your computer. | |
Finally, run this script on that HTML file. |
This file contains 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 | |
def meanclip(indata, clipsig=3.0, maxiter=5, converge_num=0.02, verbose=0): | |
""" | |
Computes an iteratively sigma-clipped mean on a | |
data set. Clipping is done about median, but mean | |
is returned. | |
.. note:: MYMEANCLIP routine from ACS library. |
This file contains 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
#!/usr/bin/env python | |
import argparse | |
import sys | |
import jinja2 | |
import markdown | |
TEMPLATE = """<!DOCTYPE html> | |
<html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
""" | |
Convert Pandas DFs in an HDFStore to parquet files for better compatibility | |
with Spark. | |
Run from the command line with: | |
spark-submit --driver-memory 4g --master 'local[*]' hdf5_to_parquet.py | |
""" | |
import pandas as pd |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
""" | |
Utilities for creating command line-like interfaces for Slack /slash commands. | |
Define your parser spec using an instance of SlashParser and then pass it to parse_args | |
for parsing. Be sure to check the returned success flag to know whether parsing | |
was successful or if there was a parsing error. | |
""" | |
import argparse | |
import re |
This file contains 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 condalist -d 'List conda environments.' | |
for dir in (ls $HOME/miniconda3/envs) | |
echo $dir | |
end | |
end | |
function condactivate -d 'Activate a conda environment' -a cenv | |
if test -z $cenv | |
echo 'Usage: condactivate <env name>' | |
return 1 |
This file contains 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 subprocess | |
import tempfile | |
import time | |
from IPython.core.magic import register_line_cell_magic | |
def snakeviz(line, cell=None): | |
""" | |
Profile code and display the profile in Snakeviz. |
NewerOlder