Skip to content

Instantly share code, notes, and snippets.

View bupkes's full-sized avatar

Matt bupkes

View GitHub Profile
@bupkes
bupkes / README.md
Last active February 5, 2023 16:42
Guardian headlines in plain text
@bupkes
bupkes / gist:ab6cd5d832389cf7c5c6dc6b07083a78
Last active August 26, 2021 19:03
East Sussex library - get loans, renew a book, renew all loans
import requests
import datetime
import bs4
import subprocess
def loans_list():
now = datetime.datetime.now()
logIn_url = "https://eastsussex.spydus.co.uk/cgi-bin/spydus.exe/PGM/WPAC/CCOPT/LB/2"
my_account = "https://eastsussex.spydus.co.uk/cgi-bin/spydus.exe/PGM/WPAC/CCOPT/LB/1"
card_number = YOUR_CARD_NUMBER
@bupkes
bupkes / convert_xml_a11y.py
Created December 27, 2020 16:51
Process a Crossword Compiler xml file to make an 'accessible' text-only version
import xml.etree.ElementTree as ET
import string
def make_accessible_from_xml(xml_file):
"""Takes a Crossword Compiler xml file and returns a dict of blanks per line, plus a list of across clues and a list of down clues"""
# This will give you the data you need to produce a text-only version of a crossword,
# which you can use to make something like the Guardian does: https://www.theguardian.com/crosswords/accessible/cryptic/28323
@bupkes
bupkes / ynab_map.py
Last active August 2, 2023 10:51
Pin all my YNAB payee locations to a map
import requests
import folium
m = folium.Map(location=[39.376591, -106.942281]) # obviously insert whatever co-ordinates you want
key = YOUR_API_KEY
home_budget_id = YOUR_BUDGET_ID
base_url = 'https://api.youneedabudget.com/v1'
headers = {"Authorization": key}
@bupkes
bupkes / bvuk_article_bot.py
Last active March 13, 2019 06:01
send new bvuk articles in an html email
import requests, bs4
from send_an_email import send_html_email
email_recipient = YOUR_EMAIL_ADDRESS
headline_file = PATH_TO_FILE # e.g bvuk_headline.txt
url = 'https://www.blindveterans.org.uk/articles'
already_got = []
with open(headline_file) as file_object:
var Masto = require('mastodon');
var FeedSub = require('feedsub');
var striptags = require('striptags');
var M = new Masto({
access_token: 'YOUR ACCESS TOKEN',
timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests.
api_url: 'https://mastodon.social/api/v1/', // optional, defaults to https://mastodon.social/api/v1/ put your own in obvs
});
@bupkes
bupkes / postcode.js
Created March 18, 2016 11:11
node.js command line tool to get latitude and longitude data from a UK postcode
// You'll need node.js installed: https://nodejs.org/en/
//To run, type "node postcode.js YOUR_POSTCODE"
// Doesn't seem to matter if you have the space in the postcode or not, or if it's in capitals
//Retrieve postcode from user input
var postcode = process.argv.slice(2);
//Create the getLatLong function
var getLatLong = function(postcode){