Skip to content

Instantly share code, notes, and snippets.

View stevenbell's full-sized avatar

Steven Bell stevenbell

View GitHub Profile
@stevenbell
stevenbell / gist:5ffcf985957e26442810
Last active August 29, 2015 14:10
Print Spark Core MAC address
// Read the MAC address of a Spark Core which can't connect to the cloud yet.
// This is useful if you're on a network that requires MAC-based registration.
// Steven Bell <[email protected]>
// 28 November 2014
SYSTEM_MODE(MANUAL); // We can't connect to the internet anyway...
byte mac[6];
void setup() {
@stevenbell
stevenbell / mkpdfs.rb
Created March 23, 2017 22:24
Make PDF slides from Inkscape document with layers
#!/usr/bin/env ruby
# Steven Bell <[email protected]>, based on https://gist.github.com/emk/961877
require 'rubygems'
require 'nokogiri'
require 'fileutils'
include FileUtils
# Delete all temporary PDF files
def delete_temporary_files
@stevenbell
stevenbell / reminders.gs
Created June 5, 2018 18:46
Weekly lunch reminder from Google spreadsheet
function myFunction() {
// Open the spreadsheet (assumes that it's shared to everyone with the link, or otherwise accessible to me)
var ss = SpreadsheetApp.openByUrl(
'<SPREADSHEET LINK HERE>');
Logger.log("Opened schedule spreadsheet: " + ss.getName());
// Pull all the data into a big array
var data = ss.getDataRange().getValues();
@stevenbell
stevenbell / mkpdfs.py
Last active December 12, 2019 21:21
Create PDF slides from layers of an Inkscape drawing
#!/usr/bin/env python3
# Convert an Inkscape SVG file into a set of PDF slides for presentation
# or printing.
#
# Requires inkscape and pdftk to be installed and in the PATH.
#
# Inspired by mkpdfs.rb (https://gist.github.com/emk/961877)
# Steven Bell <[email protected]>
#
@stevenbell
stevenbell / schedule_inbox.gs
Created August 12, 2018 18:20
Google apps script to hide incoming email and deliver it on a schedule
var LABEL_NAME = 'inbox-holding'
function setup() {
// Create a label to put paused messages in
// First go through all the labels and check that it doesn't already exist
var label = null;
allLabels = Gmail.Users.Labels.list('me');
for (var i = 0; i < allLabels.labels.length; i++) {
if(allLabels.labels[i].name == LABEL_NAME){
label = allLabels.labels[i];
@stevenbell
stevenbell / scheduleinbox.gs
Created November 5, 2018 16:59
Make Gmail arrive on a schedule
var LABEL_NAME = 'inbox-holding'
// Each time must have the format 'HOUR:MINUTE'
var schedule = [['13:00', '17:00'], // Sunday
['9:30', '13:00', '17:00'], // Monday
['9:30', '13:00', '17:00'], // Tuesday
['9:30', '13:00', '17:00'], // Wednesday
['9:30', '13:00', '17:00'], // Thursday
['9:30', '13:00', '17:00'], // Friday
['8:00', '13:00', '17:00']]; // Saturday
@stevenbell
stevenbell / homework.cls
Created September 4, 2019 16:39
LaTeX class for homework
% Class for homework which allows answers to be embedded and removed
\ProvidesClass{homework}
\LoadClass{article}
% Used for creating environment which can show/hide content
\usepackage{environ}
% Margin setup
\usepackage{geometry}
@stevenbell
stevenbell / upload_canvas_qti.py
Created October 14, 2022 18:07
Push a QTI file to canvas and configure some basic settings of the uploaded quiz
#! /bin/python3
# Push a QTI file to Canvas and configure the settings of the resulting imported quiz
# This code is public domain.
# Steven Bell <[email protected]>
from canvasapi import Canvas
import requests
from sys import argv
from time import sleep