Skip to content

Instantly share code, notes, and snippets.

View prcutler's full-sized avatar

Paul Cutler prcutler

View GitHub Profile
@prcutler
prcutler / keybase.md
Last active November 26, 2016 20:39
Keybase

Keybase proof

I hereby claim:

  • I am prcutler on github.
  • I am prcutler (https://keybase.io/prcutler) on keybase.
  • I have a public key whose fingerprint is ADC7 388B 65C4 3679 BEDF 539E 3325 CCEC 1519 68D7

To claim this, I am signing this object:

@prcutler
prcutler / account_tests2.py
Created September 17, 2018 13:18
NFLPool Account unittest
import unittest
import unittest.mock
import pyramid.testing
class AccountControllerTests(unittest.TestCase):
def test_register_validation_no_email(self):
# Arrange
from nflpool.viewmodels.register_viewmodel import RegisterViewModel
@prcutler
prcutler / account_tests3.py
Created September 17, 2018 18:37
Account Unit Tests
import unittest
import unittest.mock
import pyramid.testing
class AccountControllerTests(unittest.TestCase):
def test_register_validation_valid(self):
# 3 A's of test: Arrange, Act, then Assert
@prcutler
prcutler / gist:2d2aa67280600f183cd27609b48af4e8
Created June 19, 2019 16:58
Pytest failure on Azure Pipelines
2019-06-16T16:38:26.9433546Z ##[section]Starting: pytest
2019-06-16T16:38:26.9437615Z ==============================================================================
2019-06-16T16:38:26.9438013Z Task : Command line
2019-06-16T16:38:26.9438266Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2019-06-16T16:38:26.9438471Z Version : 2.151.1
2019-06-16T16:38:26.9439088Z Author : Microsoft Corporation
2019-06-16T16:38:26.9439208Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2019-06-16T16:38:26.9439427Z ==============================================================================
2019-06-16T16:38:27.0736206Z Generating script.
2019-06-16T16:38:27.0755042Z ========================== Starting Command Output ===========================
import board
import digitalio
import time
import adafruit_requests as requests
from adafruit_circuitplayground import cp
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
mute_on_button = digitalio.DigitalInOut(board.D4)
@prcutler
prcutler / printer.cfg
Last active May 11, 2023 11:53
Ender 3 v2 Klipper printer.cfg
# This file contains pin mappings for the stock 2020 Creality Ender 3
# V2. To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
array('H', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
Mic sample: 11856
Spec1 array([0.0, 0.0, 0.0, ..., 0.0, 0.0, 0.0], dtype=float32)
Data array([-0.0, -0.0, -0.0, ..., -0.0, -0.0, -0.0], dtype=float32)
Data & Y array([-0.0, -0.0, -0.0, ..., -0.0, -0.0, -0.0], dtype=float32) 0 Type: <class 'ndarray'> <class 'int'>
<function waves at 0x20009b80> 0
Traceback (most recent call last):
File "code.py", line 157, in <module>
@prcutler
prcutler / macropad.md
Last active November 29, 2021 18:19
CircuitPython MacroPad Encoder

while True: # Read encoder position. If it's changed, sZoom in or out. position = macropad.encoder

if position != last_position:

app_index = position % len(apps)

apps[app_index].switch()

last_position = position

if position > last_position:

Keyboard.press('Z')

[gcode_macro START_PRINT]
gcode:
#Get Printer built volume dimensions
{% set X_MAX = printer.toolhead.axis_maximum.x|default(100)|float %}
{% set Y_MAX = printer.toolhead.axis_maximum.y|default(100)|float %}
{% set Z_MAX = printer.toolhead.axis_maximum.z|default(100)|float %}
#Get Nozzle diameter and filament width for conditioning
{% set NOZZLE = printer.extruder.nozzle_diameter|default(0.4)|float %}
{% set FILADIA = printer.extruder.filament_diameter|default(1.75)|float %}
@prcutler
prcutler / csv_points_to_segments.py
Created February 20, 2022 19:27 — forked from willprice/csv_points_to_segments.py
Convert CSV to SRT subtitles
import argparse
from pathlib import Path
import numpy as np
import pandas as pd
parser = argparse.ArgumentParser(
description="",