Skip to content

Instantly share code, notes, and snippets.

View michaelaye's full-sized avatar

Michael Aye michaelaye

View GitHub Profile
@michaelaye
michaelaye / crash.txt
Created February 5, 2019 21:43
Crash report of Findings.app
Process: Findings [25603]
Path: /Applications/Findings.app/Contents/MacOS/Findings
Identifier: com.findings.Findings
Version: 2.1 [5648.9acf5aba] (5648)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Findings [25603]
User ID: 273771
Date/Time: 2019-02-05 14:40:55.981 -0700
@michaelaye
michaelaye / some.py
Created February 5, 2019 19:09
Some plotting code
for region in all_regions[:2]:
fig, axes = plt.subplots(
ncols=3, figsize=(10, 3), constrained_layout=True, sharey=False
)
fig.suptitle(region)
df1 = data.loc[data["region_name"] == region]
max_fraction = df1.fraction.max()
min_fraction = df1.fraction.min()
max_nobs = df1.n_objects.max()
min_nobs = df1.n_objects.min()
# packages in environment at /Users/klay6683/miniconda3:
#
# Name Version Build Channel
asn1crypto 0.24.0 py37_0 defaults
beautifulsoup4 4.7.1 py37_1 defaults
bzip2 1.0.6 h1de35cc_5 defaults
ca-certificates 2018.12.5 0 defaults
certifi 2018.11.29 py37_0 defaults
cffi 1.11.5 py37h6174b99_1 defaults
chardet 3.0.4 py37_1 defaults
@michaelaye
michaelaye / gist:8b5df9fddbb421d752de3bc668973432
Last active January 25, 2019 20:26
How to plot data against locale time of day only.
from matplotlib.dates import DateFormatter
from matplotlib.dates import HourLocator
from matplotlib.dates import date2num
times = pd.date_range("now", periods=24, freq="2h")
data = np.arange(len(times))
df = pd.DataFrame({"datetime": times, "data": data})
@michaelaye
michaelaye / create_py36_env.sh
Last active October 28, 2018 02:26
Conda commands to create new environment
#!/bin/bash
# add --yes below if you trust the command to prevent the y/n interaction
conda create -n py36 python=3.6 --file list_of_conda_packages.txt -c conda-forge
conda activate py36
conda config --env --add channels conda-forge
conda config --env --add pinned_packages conda-forge::numpy
#!/bin/bash
# reinstall all my packages
cd ~/Dropbox/src
for folder in 'pyciss' 'planet4' 'pyuvis' 'hirise_tools' 'pytelescope' 'nbtools' 'planetpy' 'pysis' 'p4terrains';
echo "Installing $folder";
pip install -e $folder;
echo;
done
# reinstall packages from pip that are needed
pip install -r pip_packages_to_install.txt
#!/bin/bash
. /Users/klay6683/miniconda3/etc/profile.d/conda.sh
if [ "$#" -ne 1 ]; then
echo "Usage: $0 conda_env_name" >&2
exit 1
fi
if [ -n $CONDA_DEFAULT_ENV ]
then
if [ "$CONDA_DEFAULT_ENV" == "$1" ]
@michaelaye
michaelaye / crash report
Created May 3, 2018 16:22
Spark freeze after trying to print email
This file has been truncated, but you can view the full file.
Date/Time: 2018-05-03 10:20:23 -0600
OS Version: Mac OS X 10.12.6 (Build 16G1212)
Architecture: x86_64h
Report Version: 25
Data Source: Stackshots
Command: Spark
Path: /Applications/Spark.localized/Spark.app/Contents/MacOS/Spark
Version: 1.5.10 (503)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
from __future__ import print_function
import sys
from subprocess import call
luna_ids = range(1, 7)
lunas = ['luna'+str(i) for i in luna_ids]
print(lunas)