Skip to content

Instantly share code, notes, and snippets.

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

Matthew Feickert matthewfeickert

💭
☕ + 💻
View GitHub Profile
import ROOT
from ROOT import gROOT,gPad,gStyle,TCanvas,TFile,TLine,TLatex,TAxis,TLegend,TPostScript
import os
global canvas, canvas
ROOT.gROOT.SetBatch(True)
ROOT.gStyle.SetOptStat(False)
ROOT.gStyle.SetOptTitle(False)
@betatim
betatim / does-it-limit.py
Created March 30, 2020 20:56
Highly scientific rate limit checker
import requests
import time
S = requests.Session()
now = time.time()
while True:
r = S.get(YOUR_HOST_HERE)
now_ = time.time()
delta_t = now_ - now
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@spezold
spezold / torch_percentile.py
Last active December 23, 2021 15:33
*Update (2020-10-28)*: with the introduction of torch.quantile (https://pytorch.org/docs/stable/generated/torch.quantile.html) in PyTorch 1.7 this gist has become largely obsolete – Calculate percentile of a PyTorch tensor's values, similar to numpy.percentile
from typing import Union
import torch
import numpy as np
def percentile(t: torch.tensor, q: float) -> Union[int, float]:
"""
Return the ``q``-th percentile of the flattened input tensor's data.
$ kubectl logs -f jupyter-diana-2dhep-2dpyhf-2d652kacgz (sk-phoebe)
[I 13:08:48.908 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[I 13:08:49.393 NotebookApp] JupyterLab extension loaded from /srv/conda/lib/python3.6/site-packages/jupyterlab
[I 13:08:49.393 NotebookApp] JupyterLab application directory is /srv/conda/share/jupyter/lab
[I 13:08:50.390 NotebookApp] nteract extension loaded from /srv/conda/lib/python3.6/site-packages/nteract_on_jupyter
[I 13:08:50.393 NotebookApp] Will shut down after 600 seconds with no kernels or terminals.
[I 13:08:50.395 NotebookApp] Serving notebooks from local directory: /home/jovyan
[I 13:08:50.395 NotebookApp] The Jupyter Notebook is running at:
[I 13:08:50.395 NotebookApp] http://(jupyter-diana-2dhep-2dpyhf-2d652kacgz or 127.0.0.1):8888/user/diana-hep-pyhf-652kacgz/?token=...
[I 13:08:50.395 NotebookApp
@Aerijo
Aerijo / latex_in_atom.md
Last active July 31, 2023 09:31
Setting up Atom for LaTeX

Disclaimer: I wrote the packages language-latex2e, autocomplete-latex, latex-wordcount, and hyperclick-latex. I still try to provide a list of all useful packages though, so let me know if I have missed one.

This is a general guide for how to get started with LaTeX in Atom.

NOTE: This guide assumes you already have LaTeX installed on your computer. If you do not, I recommend TeX Live.

@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 4, 2024 11:33
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@mcnees
mcnees / Example2.tex
Created September 3, 2017 01:20
Dirac delta example in PGF/TikZ
\documentclass[crop=true, border=10pt]{standalone}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
@mcnees
mcnees / Example1.tex
Created September 3, 2017 01:17
Shrinking sphere in LaTeX with PGF/TikZ
\documentclass[crop=true, border=10pt]{standalone}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage{tikz-3dplot}
@stephensekula
stephensekula / extradimenions_5D_KK_example
Created June 23, 2017 16:27
A visualization of circle-compactified 5-D Kaluza-Klein extra dimensions.
from vpython import *
import math
# Create a display
scene2 = canvas(title='Kaluza-Klein Extra Dimensions - 5D',
x=0, y=0, width=1024, height=768,
center=vector(0,-20,0), background=vector(0,0,0))