Skip to content

Instantly share code, notes, and snippets.

View garyvdm's full-sized avatar

Gary van der Merwe garyvdm

  • Johannesburg, South Africa
View GitHub Profile
This file has been truncated, but you can view the full file.
;FLAVOR:Marlin
;TIME:0
;Filament used: 0m
;Layer height: 0
;MINX:0
;MINY:0
;MINZ:0
;MAXX:220
;MAXY:220
from enum import Enum, auto
from math import atan2, cos, degrees, pi, tau, sin, sqrt, tan # NOQA
from pprint import pprint
from typing import Optional, Sequence # NOQA
from skspatial.objects import Circle, Line
from skspatial.objects import Point as SKSPoint
from skspatial.objects import Vector
from fullcontrol import ( # NOQA F401
@garyvdm
garyvdm / test_tools.py
Created May 12, 2014 19:18
Alternative to nost.tools.with_setup decorator, which allows arguments to be returned form the setup function, and passed to the test and teardown functions.
def with_setup_args(setup, teardown=None):
"""Decorator to add setup and/or teardown methods to a test function::
@with_setup_args(setup, teardown)
def test_something():
" ... "
The setup function should return (args, kwargs) which will be passed to
test function, and teardown function.
@garyvdm
garyvdm / headtail
Last active August 29, 2015 13:58
head and tail a stream
#!/usr/bin/env python
import argparse
import sys
import collections
parser = argparse.ArgumentParser(description='Show the first 10, and last 10 lines of a file.')
parser.add_argument('infile', nargs='?', default=sys.stdin,
help='Input file. Defauts to stdin if not provided.')
parser.add_argument('outfile', nargs='?', default=sys.stdout,