This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installing python3 on Mac OSX | |
brew install python3 | |
# Error: An unexpected error occurred during the `brew link` step | |
# The formula built, but is not symlinked into /usr/local | |
# Permission denied @ dir_s_mkdir - /usr/local/Frameworks | |
# Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks | |
# | |
# See: https://github.com/Homebrew/homebrew-core/issues/19286 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
""" | |
FROM: http://code.activestate.com/recipes/251871/ | |
latin1_to_ascii -- The UNICODE Hammer -- AKA "The Stupid American" | |
This takes a UNICODE string and replaces Latin-1 characters with | |
something equivalent in 7-bit ASCII. This returns a plain ASCII string. | |
This function makes a best effort to convert Latin-1 characters into | |
ASCII equivalents. It does not just strip out the Latin1 characters. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import psutil | |
import tensorflow as tf | |
from typing import Dict, Any, Callable, Tuple | |
## Data Input Function | |
def data_input_fn(data_param, | |
batch_size:int=None, | |
shuffle=False) -> Callable[[], Tuple]: | |
"""Return the input function to get the test data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# This scripts downloads the mnist data and unzips it. | |
DIR="$( cd "$(dirname "$0")" ; pwd -P )" | |
cd "$DIR" | |
echo "Downloading..." | |
for fname in train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte t10k-labels-idx1-ubyte | |
do |
OlderNewer