Skip to content

Instantly share code, notes, and snippets.

View matthewfeickert's full-sized avatar
💭
☕ + 💻

Matthew Feickert matthewfeickert

💭
☕ + 💻
View GitHub Profile
@matthewfeickert
matthewfeickert / markdown-relative-linking.md
Created June 30, 2017 14:55
Demonstrates a nice feature of in document relative linking in GitHub that fails in GitLab

In Document Relative Linking

In GitHub you can use HTML anchors to add relative links to the document allowing a user to quickly visit a reference and then return to the location in document of the reference citation. This behavior does not seem to be supported by GitLab Flavored Markdown (GFM). Why is this the case, and can this be fixed?

Code for Working Example in GitHub

### Document Text
Here is some a reference to the GitLab Flavored Markdown (GFM) section on links <a id="srcGFM">[\[1\]](#refGFM)</a>

Lorem ipsum enough times to have the link go off screen
@matthewfeickert
matthewfeickert / shape-problem.py
Last active July 7, 2017 18:44
Edward Shape Problem
import numpy as np
import tensorflow as tf
import edward as ed
# specific modules
from edward.models import Normal
def sample_model(model, n_samples):
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
samples = sess.run(model.sample([n_samples]))
@matthewfeickert
matthewfeickert / atom-package-list.txt
Last active June 24, 2018 11:50
My Atom Packages List
Hydrogen@2.5.1
atom-beautify@0.32.5
atom-material-syntax@1.0.8
atom-material-ui@2.1.3
autocomplete-python@1.10.5
build@0.70.0
build-make@0.13.0
busy@0.7.0
busy-signal@1.4.3
ex-mode@0.18.0
#!/usr/bin/env python
"""
Problem Statement: Sample from the Uniform distribution over the range [0,1]
until the sum of the numbers sampled is greater than 1. On average, how
many samples are taken?
Answer: e
Problem Source: https://twitter.com/fermatslibrary/status/924263998589145090
Author: Matthew Feickert
Date: 2016-10-28
"""
@matthewfeickert
matthewfeickert / config_example.py
Last active October 23, 2023 09:32
JSON config files with argparse from the CLI example
import json
import argparse
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams['text.usetex'] = True
# Inspiration came from https://stackoverflow.com/q/3609852/8931942
$ ssh feickert@lxplus-cloud.cern.ch -CX
$ source ~recast/public/setup.sh
(venv) [feickert@lxplus074 ~]$ recast catalogue ls
NAME DESCRIPTION
examples/rome Example from ATLAS Exotics Rome Workshop 2018
(venv) [feickert@lxplus074 ~]$ recast run examples/rome
2018-07-23 13:54:22,089 | pack.eventselection. | INFO | starting file loging for topic: step
@matthewfeickert
matthewfeickert / Dockerfile
Last active January 23, 2019 01:49
Example of release day bug in pip 19.0 with the --no-cache-dir option (https://github.com/pypa/pip/issues/6158)
FROM ubuntu:bionic
USER root
WORKDIR /root
SHELL [ "/bin/bash", "-c" ]
ARG PYTHON_VERSION_TAG=3.6.8
ARG LINK_PYTHON_TO_PYTHON3=0
@matthewfeickert
matthewfeickert / README.md
Created February 1, 2019 21:51
Bash tab completion of activation of Python virtual environments (that are installed under `$HOME/venvs`)

Bash tab completion of activation of Python virtual environments

If _venv-activate.sh is installed at /opt/_venv-activate/_venv-activate.sh then if the following is added to a user's ~/.bashrc

# Enable tab completion of Python virtual environments
if [ -f /opt/_venv-activate/_venv-activate.sh ]; then
    . /opt/_venv-activate/_venv-activate.sh
fi
@matthewfeickert
matthewfeickert / sekula_pyhf.py
Last active March 4, 2019 08:21
Working toy model of a simple signal + background model with pseudodata generated from the background model
import matplotlib.pyplot as plt
import numpy as np
import pyhf
def generate_background(n_events, tau=50.0):
"""
Sample events from an exponential distribution
Args: