Skip to content

Instantly share code, notes, and snippets.

View rreece's full-sized avatar
🙈
doing things

Ryan Reece rreece

🙈
doing things
View GitHub Profile
@rreece
rreece / Dockerfile.centos7.python36.pipenv
Created August 3, 2018 01:07 — forked from pvergain/Dockerfile.centos7.python36.pipenv
Dockerfile based on centos:7 Python3.6 and pipenv
# Use an official centos7 image
FROM centos:7
RUN localedef -i fr_FR -c -f UTF-8 -A /usr/share/locale/locale.alias fr_FR.UTF-8
ENV LANG fr_FR.utf8
# gcc because we need regex and pyldap
# openldap-devel because we need pyldap
RUN yum update -y \
&& yum install -y https://centos7.iuscommunity.org/ius-release.rpm \
@rreece
rreece / mv_files.sh
Created June 27, 2018 18:34
Bash script to continuously watch for output files and move them
#!/usr/bin/env bash
log=mv_files.log
spare=/spare/ryan
dest=/cb/data/imagenet1k2/new/
while true; do
if test -n "$(shopt -s nullglob; echo $spare/*)"
then
echo "Moving files to $dest"
echo "Moving files to $dest" >> $log
ls -rt1 $spare | head -n -10 | xargs -n 1 echo
@rreece
rreece / np_to_tfrecords.py
Created June 21, 2018 02:12 — forked from swyoon/np_to_tfrecords.py
From numpy ndarray to tfrecords
import numpy as np
import tensorflow as tf
__author__ = "Sangwoong Yoon"
def np_to_tfrecords(X, Y, file_path_prefix, verbose=True):
"""
Converts a Numpy array (or two Numpy arrays) into a tfrecord file.
For supervised learning, feed training inputs to X and training labels to Y.
For unsupervised learning, only feed training inputs to X, and feed None to Y.
@rreece
rreece / rootnotes.py
Last active August 29, 2015 14:17 — forked from mazurov/rootnotes.py
"""
Helper module for displaying ROOT canvases in ipython notebooks
Usage example:
# Save this file as rootnotes.py to your working directory.
import rootnotes
c1 = rootnotes.default_canvas()
fun1 = TF1( 'fun1', 'abs(sin(x)/x)', 0, 10)
c1.SetGridx()
#!/usr/bin/env python
# Set up ROOT and RootCore
import ROOT
ROOT.gROOT.Macro('$ROOTCOREDIR/scripts/load_packages.C')
# Initialize the xAOD infrastructure
ROOT.xAOD.Init()
# Set up the input files (PDSF)