Skip to content

Instantly share code, notes, and snippets.

@phubbard
phubbard / generate.py
Created July 31, 2023 18:37
Litra HID strings for various color temperatures
Code:
"""
This module defines a library for accessing the functionality of the
Logitech Litra Glow
"""
if __name__ == '__main__':
for x in range(2700, 6600, 100):
byte_array = x.to_bytes(2, 'big')
# print(f'{x=}', 0x02, [0x11, 0xff, 0x04, 0x9c, byte_array[0], byte_array[1], 0x00, 0x00,

Keybase proof

I hereby claim:

  • I am phubbard on github.
  • I am pfhubbard (https://keybase.io/pfhubbard) on keybase.
  • I have a public key whose fingerprint is F329 D988 91D1 0238 4BAE 1A24 7491 C26C 24B2 CA22

To claim this, I am signing this object:

@phubbard
phubbard / README.md
Last active February 27, 2024 22:32
Python script to move DOSbox print files into the Unix print queue. Works by watching the modification time, when it's been idle 10 seconds it prints it and deletes the file. This is for a Raspberry Pi running fastdosbox, which is being used at our elementary school. The school needs a machine that can run an ancient DOS app and print to a Panas…

Introduction

This is to document the work I did in making a Raspberry Pi DOS machine for my daughters' school.

Goals

Run The Learning Center "Children's Writing and Publishing" app, including the ability to print to a Panasonic KXP-1124 dot matrix printer.

Hardware

@phubbard
phubbard / ads and spyware
Created June 26, 2013 21:33
Current HTTP blacklist from my home firewall, implemented as a deny list in Squid.
ic-live.com
hearstmags.com
buzzfeed.com
tynt.com
nrelate.com
omtrdc.net
revsci.net
raasnet.com
adtechus.com
kromtech.net
@phubbard
phubbard / tt.ino
Created December 8, 2012 21:27
Arduino code for a 2-minute timer, with bargraph countdown and a few basic effects. Press reset to start the timer, only needs LEDs to work.
/*
Arduino code for a 2-minute timer, with bargraph countdown and a few basic effects. Press reset to star the timer,
only needs LEDs to work.
pfh 12/8/12, with anna, starting from blink example.
*/
int num_leds = 7;
int led_pins[] = {12, 11, 10, 9, 8, 7, 6};
int delay_msec = 17142; // 120 seconds divided by number of leds
@phubbard
phubbard / pagewatcher.py
Created August 23, 2012 02:03
Watch a web page, this is a tutorial for http://citizenscientistsleague.com
#!/usr/bin/env python
# Paul Hubbard 7/11/12
# Simple script to watch a web page for a change and ping me via email.
# Mostly for fun.
import re
import urllib2
import logging as log
import smtplib
@phubbard
phubbard / upload.py
Created February 24, 2012 19:45
Upload images for Octopress, with validation and editor integration
#!/usr/bin/env python
"""
Idea - image uploader for Octopress.
Given a filename (list later), we want to
- make the filename url-friendly (maybe replace spaces with dashes or just urlencode it)
- Create a directory on the server in the form {base}/YYYY/mm/dd/{filename}
- copy it up
- Do a URL get and md5-sum to verify success
@phubbard
phubbard / whotoblame
Created April 15, 2011 21:47
Shell script pipeline to track down the authors of Pyflakes errors
for e in `pyflakes ion | grep undefined | cut -d \: -f 1,2`; do s=`echo $e | awk -F \: '{printf("git blame -L %s,%s %s\n",$2,$2,$1)}'`; eval $s; done;
#!/usr/bin/env python
"""
@file bf.py
@author Paul Hubbard
@date 1/27/10
@brief Compute the max depth of the social network as given by
@see http://pypi.python.org/pypi/python-Levenshtein/0.10.2
Algorithm: Brute force.
@phubbard
phubbard / Doxyfile
Created December 8, 2010 04:33
Using doxygen and mscgen to define some code
# Doxyfile 1.6.1
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
# All text after a hash (#) is considered a comment and will be ignored
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]