Skip to content

Instantly share code, notes, and snippets.

View iancze's full-sized avatar

Ian Czekala iancze

View GitHub Profile
@raeidsaqur
raeidsaqur / jupyter.slurm
Last active November 19, 2023 13:17
SLURM script for opening a Jupyter Notebook tunnel
#!/bin/bash
#SBATCH -p p100
#SBATCH --gres=gpu:1
#SBATCH -c 4
#SBATCH --mem=16G
#SBATCH --nodes=1
#SBATCH --ntasks=1
##SBATCH --ntasks-per-node=1
#SBATCH --time=04:00:00
#SBATCH --job-name=jupyter-notebook
@gully
gully / zenodo_upload.py
Created April 5, 2018 20:54
A function to use the Zenodo API to automatically upload your large, raw, emcee MCMC chain .npy files for reproducibility of posteriors. Requires a Zenodo API token.
#!/usr/bin/env python
import os
import requests
#See http://developers.zenodo.org/ to get a token
# You may want to change your token path
## Also, do not share your token, it is like a password!
token_file = "../token.txt"
token_fn = os.path.expandvars(token_file)
@astrofrog
astrofrog / async_plotting.py
Created December 10, 2011 00:11
Asynchronous Plotting in Matplotlib: rather than call savefig directly, add plots to an asynchronous queue to avoid holding up the main program. Makes use of multiple processes to speed up the writing out. Suggestions welcome!
import time
import multiprocessing as mp
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt