This file contains 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 | |
"""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 |
This file contains 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 collections | |
import csv | |
import glob | |
import itertools | |
import locale | |
import operator | |
import os | |
import pprint | |
import re | |
import sys |
This file contains 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
# 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 |
This file contains 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
# Just run 'pytest' from the directory containing this file. | |
from pytest import fixture | |
def test_a(foo): | |
assert 0, foo | |
def test_b(foo): |
This file contains 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
#!/bin/bash | |
# macOS tool to edit the contents of the clipboard in the default text editor | |
# If your editor supports pipelining it can simplify to: | |
# pbpaste | $EDITOR | pbcopy | |
# pbpaste | mate -w | pbcopy # example | |
tmpfile=`mktemp` | |
pbpaste > $tmpfile | |
$EDITOR $tmpfile |
This file contains 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
# Using this bash function (for color): | |
# color()(set -o pipefail;"$@" 2>&1>&3|sed $'s,.*,\e[31m&\e[m,'>&2)3>&1 | |
# repeat each section by pasting after this: | |
# color python; echo $? | |
# | |
# Notice how ctx1 never does the correct cleanup by printing "exiting". | |
# Defining a context manager class. | |
class CTX: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer