Skip to content

Instantly share code, notes, and snippets.

View bradmontgomery's full-sized avatar

Brad Montgomery bradmontgomery

View GitHub Profile
@bradmontgomery
bradmontgomery / packages.txt
Created December 31, 2023 18:26
Packages I've installed during my journey using Linux Mint
1password
ack
apt-transport-https
battery-stats
bcmwl-kernel-source
build-essential
chromium-browser
cmdtest
conky-all
direnv
@bradmontgomery
bradmontgomery / index.html
Last active June 14, 2023 02:28
Forms & DOM nodes
<h1>Grocery List</h1>
<form action="" method="get" id="groceries">
<label for="item">Grocery Item</label>
<input type="text" id="item" name="item">
<input type="submit" value="Add Item">
</form>
<ul id="grocery-items">
</ul>
@bradmontgomery
bradmontgomery / mempy-2022-05-16.md
Last active May 17, 2022 00:18
MEMpy 2022-05-16 --> What's new in Python 3.11

MEMpy 2022-05-16

What's new in python 3.11 -- Coming Soon!

python release timeline

Official Releases from 1996 - 2022

@bradmontgomery
bradmontgomery / list_gists.py
Last active March 6, 2024 20:23
Quick & dirty hack to list a user's gists, sorted by stars
#!/usr/bin/env python
"""
A quick & dirty hack to list all of your Gists sorted by stars.
This script lists your gists, the number of stars, the number of comments,
a truncated description, and the url for the gist.
NOTE: This only returns public gists. If you want to see (your own) private gists,
you can provide a personal access token.
@bradmontgomery
bradmontgomery / config.ini
Last active September 27, 2019 20:57
Python config parsing / access experiment.
[DEFAULT]
num = 42
pi = 3.141312301928312039810
debug = no
on = yes
sleep = 2
[mqtt]
host = localhost
port = 1883
@bradmontgomery
bradmontgomery / main.py
Last active August 5, 2019 15:56
Playing with RQ priorities
#!/usr/bin/env python3
"""
Experiment to show how rq priorities might work with jobs that will complete in different amounts of time...
IF you run a single worker (rqworker high low), this may do what you expect, but if you run multiple workers,
the low-priority tasks that take less time may complete before some of the high-priority tasks.
$ python main.py
Enqueued work for 0 in HIGH
@bradmontgomery
bradmontgomery / publishers.py
Created May 13, 2019 13:56
Simple example of MQTT publishers / subscriber using paho.mqtt
#!/usr/bin/env python
"""
Spawn a lot of publishers.
"""
import json
import os
import random
import sys
@bradmontgomery
bradmontgomery / pytables_cheatsheet.md
Last active September 26, 2019 22:37
Pytables cheatsheet

On using pytables; how do I...

A lot of this info is in the docs for Tables.

Open the file for reading, and get a reference to a table:

>>> with tables.open_file(path, mode='r') as f:
...     table = f.root.some_columns.table
@bradmontgomery
bradmontgomery / get_accel_data.py
Last active March 5, 2019 22:48
Example code to fetch accelerometer data from the Preteckt API.
"""
This example python code shows how to appropriately query the Preteckt
accelerometer API for data over a date range.
Run with:
$ python get_accel_data.py
@bradmontgomery
bradmontgomery / friendly.py
Created February 4, 2019 22:36
A function to enumerate and print a list of items horizontally using the space available in your terminal (optionally, without wrapping text).
"""
A function to enumerate and print a list of items horizontally using the
space available in your terminal (optionally, without wrapping text).
Example:
>>> friendly.test()
1. a cat 2. a dog 3. Three pairs of socks 4. A kick-ass bicycle
5. chickens 6. A quick brown fox 7. and a lazy dog
8. Lorem ipsum dolor sit amet, consectetur