Skip to content

Instantly share code, notes, and snippets.

View lmergner's full-sized avatar

Luke Thomas Mergner lmergner

View GitHub Profile
@lmergner
lmergner / pip_install_from_setup_cfg.py
Last active October 22, 2020 14:27
A simple python script to read setup.cfg and install our requirements
"""
A simple python script to read setup.cfg and install our requirements
Why? Replace pip -r requirements in CI/CD or Docker environments.
"""
# using pip._internal.main
# https://stackoverflow.com/questions/12937533/use-pip-install-uninstall-inside-a-python-script
@lmergner
lmergner / local_weather_textexp.py
Created July 1, 2013 22:18
TextExpander snippet for printing current weather conditions to www.DailyMile.com workouts. Requires wunderground.com api key.
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Local Weather TextExpander Snippet
==================================
Quickly enter local weather conditions, specifically current temp
in www.dailymile.com workouts. This is useful for tracking
performance against temperature more closely than dailymile.com
currently allows with their pictures.
@lmergner
lmergner / test_argparse.py
Last active December 18, 2015 23:48
Fuzzy testing argparse subparser subcommands Looking for advice and feedback.
#!/usr/local/env python
#-*- coding: utf-8 -*-
"""
Argparse Testing Utilities
==========================
Because we want some random strings suitable for testing the
input and output of :func:argparse.parser().
Why? I keep slightly modifying my argparse options, and I want
@lmergner
lmergner / wordcount.py
Last active December 17, 2015 15:29
A small command line utility taking one argument--a text file--counts the words and prints the number.
#!/usr/bin/python
__doc__ = "A small command line utility taking one argument--a text file--counts the words and prints the number."
import os, sys
if len(sys.argv) == 2:
with open(os.path.abspath(sys.argv[1])) as f:
text = f.read()