Skip to content

Instantly share code, notes, and snippets.

View MilesCranmer's full-sized avatar

Miles Cranmer MilesCranmer

View GitHub Profile
@MilesCranmer
MilesCranmer / nobels_by_country.md
Last active June 18, 2017 11:55
Nobel prizes by country, per capita and per scientist, post-1985 and post-1970

Rankings

First, let's look at just physics.

Since this is a lot less data to work with, we'll take prizes from 1970 onwards.

Country Nobels in Physics 2016 population (millions) Nobels per million
Denmark 2 5.7 0.350877193
@gerjantd
gerjantd / gist:2436686
Created April 21, 2012 11:24
Github: fork your own repo
http://bitdrift.com/post/4534738938/fork-your-own-project-on-github
1. Create a new repo named bar at github.com
2. git clone https://gerjantd@github.com/gerjantd/foo.git bar
3. cd bar
4. vi .git/config
replace foo with bar
@MilesCranmer
MilesCranmer / use_pymc3_like_emcee.py
Last active October 2, 2019 02:37
Use PyMC3 like emcee
##########################################
#emcee example:
##########################################
import numpy as np
import emcee
# Number of samples for each chain.
N_samp = 1000
def log_prob(x):
@yk
yk / .vimrc
Created July 6, 2020 14:26
vimrc july 2020
set nocompatible " be iMproved, required
let g:python3_host_prog = '/usr/local/opt/python@3.8/bin/python3.8'
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
@lgarrison
lgarrison / high_performance_python.ipynb
Last active July 23, 2020 14:10
High-Performance Python, or When to Write For Loops in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#
# Kurtosisf.py calculates the spectral kurtosis from fast-capture .dada files
# and outputs spectral kurtosis, real and imaginary kurtosis values, and flagging
# information for each window of every channel in all of the antennas.
# Commented out code relates to making histograms, and other junk. I know it's a mess.
#
# Original code written by Hugh Garsden
# Edited and made a general mess of by Alex Bailey, June 2017
#
@benwillkommen
benwillkommen / _readme.md
Last active June 27, 2022 21:27
Unsubscribe from all watched repositories in a particular organization

Remove All Subscriptions from a Specific Github Organization

This script will delete all the subscriptions in your account for the Github Organization passed to it.

This script was created when I took a new job, and my notification settings inadvertantly subscribed me to all 600+ of their repos. I wanted a better signal to noise ratio in my notifications, but I didn't want to click the "Unwatch All" button, which would remove my subscriptions to repos outside my new employer's org.

How To

  1. Create a Personal Access Token with the "repo" scope, and expose it as the GITHUB_PERSONAL_ACCESS_TOKEN environment variable:
$ export GITHUB_PERSONAL_ACCESS_TOKEN=
@farr
farr / latexbuild.yml
Created October 2, 2020 18:32
GitHub Action for auto-building your LaTeX paper
name: latex-build
on: [push]
jobs:
build-latex:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install TeXlive
run: sudo apt-get install texlive texlive-publishers texlive-science latexmk
@MikeInnes
MikeInnes / startup.jl
Last active February 5, 2023 12:54
Some useful macros for Julia
# Repeat an operation n times, e.g.
# @dotimes 100 println("hi")
macro dotimes(n, body)
quote
for i = 1:$(esc(n))
$(esc(body))
end
end
end
@pat-alt
pat-alt / cp_sr.jl
Last active July 31, 2023 09:50
Symbolic Regression with Conformal Prediction Intervals.
using ConformalPrediction
using Distributions
using MLJ
using Plots
# Inputs:
N = 600
xmax = 3.0
d = Uniform(-xmax, xmax)