Skip to content

Instantly share code, notes, and snippets.

View walkerh's full-sized avatar

Walker Hale IV walkerh

  • Baylor College of Medicine, HGSC
  • Houston, TX
View GitHub Profile
@walkerh
walkerh / tar_demo.sh
Last active August 9, 2016 19:45
Demonstration of copying files from disparate directories into a synthetic directory inside a new tarball. Note that most of this code is just setting up some files and directories to demonstrate the power. Focus your attention on the "xargs tar" command on line 19.
# Copying files from disparate directories into a single tarball
# with a synthetic root directory:
# Setup some dummy directory structure for the demo:
DEMO_DIR=/tmp/tar-demo
mkdir -p $DEMO_DIR
cd $DEMO_DIR
mkdir -p a/1/d a/1/e b/2 b/3 c
xargs touch <<EOD
a/1/d/foo
@walkerh
walkerh / wh_lib.py
Created March 15, 2016 22:56
Utility code for data wrangling
import collections
import csv
import glob
import itertools
import locale
import operator
import os
import pprint
import re
import sys
@walkerh
walkerh / scanner.py
Created March 15, 2016 22:52
Recursively scan the specified directory, emitting manifest of files.
#!/usr/bin/env python3
"""Recursively scan the specified directory, emitting manifest of files.
Writes to file or stdout.
Requires Python 2.7+
"""
import argparse
from hashlib import md5 as hash