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
[run] | |
parallel=True | |
omit = | |
test_*.py |
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
from pathlib import Path | |
from aiohttp import web | |
from aiohttp.web_response import Response | |
async def index(request): | |
# This just demonstrates how the HTML can reference another endpoint in this server. | |
return Response( | |
text='<html><body><img src="/image"></body></html>', |
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
def find_dominating(filename: str, start_path: Path): | |
"""Look for `filename` in `start_path` or any of its ancestor directories. | |
Args: | |
filename: The filename to look for | |
start_path: The directory in which to start the search | |
Returns: The dominating path | |
Raises: |
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
#!/bin/bash | |
# This does a simple local-to-local duplicity backup with no encryption. It keeps backups for a year. | |
export LOGFILE=<path to log file> | |
export SOURCE=<path to source directory> | |
export DEST=<path to destination directory> | |
# Without this, duplicity gets upset. | |
ulimit -n 1024 |
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
from rope.base import libutils | |
import rope.base.project | |
from rope.refactor.rename import Rename | |
project = rope.base.project.Project('.') | |
resource = libutils.path_to_resource(project, './sample.py') | |
renamer = Rename(project, resource, 81) # offset=81 | |
changes = renamer.get_changes('Fnord') | |
project.do(changes) |
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
inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileQuit $1 | |
# inkscape --export-height=75 --export-png=$1.png $1 |
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
for i in *.pdf; do basename="${i%.*}"; sips -s format png -s dpiWidth 300 -s dpiHeight 300 --resampleWidth 1500 ${basename}.pdf --out ${basename}.png; done |
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 io | |
import sys | |
# Temporarily redirect stdout to a StringIO. | |
stdout = sys.stdout | |
s = io.StringIO() | |
sys.stdout = s | |
help(sys.intern) |
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
(defun run-python-tests (root-dir test-subdir buffer-name) | |
(interactive) | |
(let ((default-directory root-dir) | |
(buff (get-buffer-create buffer-name))) | |
(display-buffer buff) | |
(shell-command (concat "python -m unittest discover " test-subdir) buff) | |
(with-current-buffer buff | |
(compilation-mode)))) | |
; This hook runs the tests after each save, a TDD-esque workflow. |