Jupyter Environment Management for Dummies

This is another one of those “I kept googling the same thing over and over again” things that needed a post, except this time I made an issue to make a post and then started to repeatedly refer to that. TL;DR When you want to spin up an experimental environment and get it tied in to your Jupyter environment of choice (I actually quite like JupyterLab Desktop these days…), you need two steps. ...

January 17, 2024 · Andrew Bolster

Pulling Election Count data out of Google Sheets for fun and democracy

Messing around with Elections NI data Sources: Live Data (for 2023) 2022 Assembly Elections Creating your own Google Sheet and referencing the crowdsourced data The above linked spreadsheets are naturally not editable by everyone; this is great for reliable data but isn’t so great when you want to make pretty graphs. Google Sheets supports the live referencing of external sheets in your own sheets, so you can ‘import’ the data from the read-only sheets as they evolve over the count, and then reference those data in your own visualisations. ...

May 18, 2023 · Andrew Bolster

Counting Tabs and Background Tasks: Taunting Goodharts Demon

This was going to be a really quick post yesterday, but I’ve spent the guts of a day (between actual work) just getting the simplest bit of this working. The intent I was silly enough to say this to someone recently in work: It’s a good day when I end up with fewer firefox tabs open than when I started And a plan was hatched; Find API to query Firefox for current number of open Tabs across all window instances Send that value to my internal MQTT node (that has telegraf, influx, home assistant and grafana integrations too) Repeat Spoiler alert, number 3 was the bastard ...

July 22, 2021 · Andrew Bolster

Apache Arrow in 5-10 Mins

The below was presented as part of the Belfast Linux Users Groups’ May Technical Meetup. I’m also maintaining this ‘short’ as part of my gradually accumulating ‘python_data_workshop’, so that may be the best place to see updates if you’re reading this any later than 2021. Conditions Theme: ‘Universal Screwdrivers’ Event: BLUG Time: ‘5-10mins’ (take the 10) Slides Transcript Evening folks, and I’m happy to be appearing in what we hope is the last virtual BLUG! We’ve all spent a long time toiling in our own little worlds in relative isolation over the course of this sequence of lockdowns, and its appropriate that now as we begin coming back together, that we’re talking about projects that operate and complement across ecosystems. ...

June 1, 2021 · Andrew Bolster

Python Script as a Reliable Service

I was asked to help out a friend who had an installation in an art gallery that stopped booting properly, and was reminded that I keep forgetting to actually write this post. Running a python script as a reliable, retryable service on a Raspberry Pi that waits for an ‘up’ network connection, because I’m an idiot who keeps changing his mind how to do it. Fail gracefully and with informative error messages: try: ... except:... is your friend ...

November 21, 2019 · Andrew Bolster

Daily Dated Untitled Jupyter Notebooks

I am a heavy user of Jupyter Notebook, both personally for wrapping my head around Open Data, professionally for analysis and reporting, and for education/presentations. So am very comfortable with just spinning up new notebooks all over the show. However, this ends up looking like this… Less than informative and impossible to work out WTF I was doing. Helpfully, there’s a way to change it. In your jupyter_notebook_config.py file (Normally in ~/.jupyter), add the following somewhere sensible ...

October 22, 2018 · Andrew Bolster

Those who can...

I was digesting “The Design of Design” by Fred Brooks as a bit of holiday reading, which talks in great depth about the nature of technical and architectural design from a practical perspective, and it made me thinking about my own experience and the “future” of that experience. Blessing or curse, due to my inability to say no and (publically) boundless patience exploration of a range of areas, in technology, security, academia, business, and society; several people have made flippant, off the cuff comments about some form of predicted success, usually financial or technical. ...

May 28, 2013 · Andrew Bolster

K8055 USB + Python + Twitter + IRC: Space Indicator as a OS Service

** After a long time in the oven, Farset Labs is up and running. Unforanately we don’t have any of the crazy equipment yet, since we’re broke. As my first ‘official’ Farset Labs project, I’ve installed a ‘Big Red Button’ to notify the @FarsetLabs twitter feed and #FarsetLabs on Freenode to the status of the space. Basically, first person pushes the BRB down in the morning, then one of the directors key-unlocks the space to ‘close’ it. ...

April 10, 2012 · Andrew Bolster

Python + irclib for IRC Status Updates

IRC, Python, Ubuntu linux. Simples! Same as by Twitter post, but for IRC. Biggest problem with this one was working out that the IRC server needs to be kept alive with the irclib.IRC.process_once() command. This is wrapped in the while loop that assumes that there is other stuff going on for which you are waiting on a condition to be satisfied, but could easily be ignored if one is just sending out one message. Also, the PRIVMSG command can be used to broadcast to a channel, as is used here, or, as the name suggests, to communicate with a specific user. ...

April 10, 2012 · Andrew Bolster

Python + Oauth2 for Twitter Status Updates

Working on the Farset Labs Big Red Button for space occupancy, had to find a simple way to tweet a status. This is a post to remind myself and anyone else who has dived through hundreds of incorrect, out of date, or inapplicable examples of Oauth 2 with Twitter using a pre-generated auth-token pair. import oauth2 as oauth import urllib ckey='$CONSUMER_KEY' csecret='$CONSUMER_SECRET' akey='$AUTH_TOKEN' asecret='$AUTH_SECRET' def post_twitter(status): try: consumer = oauth.Consumer(key=ckey, secret=csecret) token = oauth.Token(key=akey, secret=asecret) client = oauth.Client(consumer, token) resp, content = client.request( postapi, method='POST', body = urllib.urlencode({"status": status, "wrap_links": True}), #headers=http_headers, #force_auth_header=True ) except oauth.Error as err: print("Twitter Error:"+err) return resp, content post_twitter("Hello Twitterverse")

April 10, 2012 · Andrew Bolster