Skip to content

Instantly share code, notes, and snippets.

View lindsaymarkward's full-sized avatar

Lindsay Ward lindsaymarkward

View GitHub Profile
@lindsaymarkward
lindsaymarkward / toc_text_split.py
Created February 21, 2020 04:40
Split one text string Table Of Contents (copied from PDF) into readable paragraph/list form
text = "Chapter 1 Introduction to Computers and Programming 19 1.1 Introduction 19 1.2 Hardware and Software 20 1.3 How Computers Store Data 25 1.4 How a Program Works 30 1.5 Using Python 38 Chapter 2 Input, Processing, and Output 49 2.1 Designing a Program 49 2.2 Input, Processing, and Output 53 2.3 Displaying Output with the print Function 54 2.4 Comments 57 2.5 Variables 58 2.6 Reading Input from the Keyboard 67 2.7 Performing Calculations 71 2.8 More About Data Output 83 Chapter 3 Decision Structures and Boolean Logic 99 3.1 The if Statement 99 3.2 The if-else Statement 108 3.3 Comparing Strings 111 3.4 Nested Decision Structures and the if-elif-else Statement 115 3.5 Logical Operators 123 3.6 Boolean Variables 129 Chapter 4 Repetition Structures 139 4.1 Introduction to Repetition Structures 139 4.2 The while Loop: A Condition-Controlled Loop 140 4.3 The for Loop: A Count-Controlled Loop 148 4.4 Calculating a Running Total 159 4.5 Sentinels 162 4.6 Input Validation Loops 165 4.7 Nested Loops 170 Chapter 5
@lindsaymarkward
lindsaymarkward / install_homebridge.sh
Created April 2, 2017 23:13
Install homebridge on hassbian
#!/bin/bash
echo
echo "Homebridge install script for Hassbian"
echo
if [ "$(id -u)" != "0" ]; then
echo "This script must be run with sudo. Use \"sudo ${0} ${*}\"" 1>&2
exit 1
fi
@lindsaymarkward
lindsaymarkward / sphere-orvibo_output
Created May 9, 2015 13:18
sphere-orvibo test learning 1
ninja@ninjasphere:/data/sphere/user-autostart/drivers/sphere-orvibo$ DEBUG=* ./sphere-orvibo > outputTest
2015-05-09 13:05:19 INFO logger.go:49 Root logger initialized at level DEBUG
2015-05-09 13:05:19 INFO photography.davidgray.sphere-orvibo.connection Connection.go:48 Connecting to localhost:1883 using cid:photography.davidgray.sphere-orvibo
2015-05-09 13:05:19 INFO bus Bus.go:26 Using mqtt bus implementation: tiny
2015-05-09 13:05:20 INFO photography.davidgray.sphere-orvibo.connection Connection.go:52 Connected
2015-05-09 13:05:20 DEBUG schemas schemas.go:258 Fetching document from file:///service/discover#/methods
2015-05-09 13:05:20 DEBUG rpc server.go:73 Validating event 'announce' (schema: http://schema.ninjablocks.com/service/discover#/events/announce/value). Payload: [0x10737b80]
2015-05-09 13:05:20 DEBUG mqtt-jsonrpc2 server.go:108 < Outgoing to $discover/event/announce : {"params":[{"topic":"$discover","schema":"http://schema.ninjablocks.com/service/discover","supportedMethods":["services"],"supp
@lindsaymarkward
lindsaymarkward / checkLetters.py
Created March 9, 2015 00:28
Check if a string contains all letters of the alphabet.
"""
Lindsay Ward, 09/03/2015
Quick program to check if a string contains all letters of the alphabet
"""
__author__ = 'sci-lmw1'
test1 = "Playing jazz vibe chords quickly excites my wife."
test2 = "The quick brown fox jumped over the lazy dog."
letterCounts = [0] * 26