Skip to content

Instantly share code, notes, and snippets.

#include<iostream>
#include<stdexcept>
#include<string>
void print_usage() {
std::cout << "usage: test [args...]\n"
<< '\n'
<< " help display this message and exit\n"
<< " x <int> set x\n";
}
#include<iostream>
int main() {
double total = 0;
double tmp;
while (std::cin >> tmp) {
total += tmp;
}
std::cout << total;
return 0;
#!/usr/bin/env python
from __future__ import print_function
import sys
import numpy as np
from scipy.ndimage.measurements import center_of_mass
dxy = 0.1
@jbernhard
jbernhard / config
Created September 11, 2014 22:30
SSH connection sharing
#
# ~/.ssh/config
#
# share connections
Host *
ControlMaster auto
ControlPersist 5m
ControlPath /tmp/ssh-%r@%h:%p
@jbernhard
jbernhard / 30-scale-font.conf
Created September 3, 2014 15:02
Scale font size, useful for hidpi.
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="font">
<test name="family">
<string>Inconsolatazi4</string>
</test>
<edit name="pixelsize" mode="assign">
def event_generator(phi_column_number, pT_column_number):
"""
Lazily generate arrays of phi angles and pT for each event.
Fastest way I can find to read a numerical text file in chunks,
where the chunks are of non-uniform size and separated by markers in the text file.
"""
event = []
#!/usr/bin/env python3
"""
Calculate v2{2} for an isotropic emission law (zero flow). Will converge
to zero as the number of particles -> infinity.
"""
import itertools
import sys
globus-url-copy file:///home/jeb65/testfile gsiftp://osg-xsede.grid.iu.edu/home/jeb65/testfile-copied
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 9.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from numpy.random import random
import itertools
colors = ('b', 'g', 'r')