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
def latest_match_from(path, match): | |
# read the modification time | |
mtime = lambda f: os.stat(os.path.join(path, f)).st_mtime | |
# read all files from path and sort based on modification time | |
files = list(sorted(os.listdir(path), key=mtime)) | |
# filter based on match | |
matches = [a for a in files if match in a] | |
# return the full path of the most recent match | |
return os.path.join(path, matches[-1]) |
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
class Config: | |
def __init__(self, a, b): | |
self.a = a | |
self.b = b | |
config = Config(1, 2) | |
script = "./my_script.py" | |
# note the "" around config | |
command = "python {script} \"{config}\"".format(script=script, config=vars(config)) | |
os.system(command) |
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/sh | |
## A little script to make it easier to launch DiffMerge from the command line. | |
## Install this script into a folder in your path, such as /usr/bin or /usr/local/bin. | |
## | |
## Version 3.3.0.1001 | |
## Copyright (C) 2003-2009 SourceGear LLC. All Rights Reserved. | |
############################################################################## | |
## Change DIFFMERGE_PATH to point to where you installed DiffMerge |
OlderNewer