Skip to content

Instantly share code, notes, and snippets.

Avatar

Steven Bell stevenbell

View GitHub Profile
@stevenbell
stevenbell / homework.cls
Created Sep 4, 2019
LaTeX class for homework
View homework.cls
% 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 / scheduleinbox.gs
Created Nov 5, 2018
Make Gmail arrive on a schedule
View scheduleinbox.gs
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 / schedule_inbox.gs
Created Aug 12, 2018
Google apps script to hide incoming email and deliver it on a schedule
View schedule_inbox.gs
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 / mkpdfs.py
Last active Dec 12, 2019
Create PDF slides from layers of an Inkscape drawing
View mkpdfs.py
#!/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 <botsnlinux@gmail.com>
#
@stevenbell
stevenbell / reminders.gs
Created Jun 5, 2018
Weekly lunch reminder from Google spreadsheet
View reminders.gs
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.rb
Created Mar 23, 2017
Make PDF slides from Inkscape document with layers
View mkpdfs.rb
#!/usr/bin/env ruby
# Steven Bell <sebell@stanford.edu>, 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 / gist:5ffcf985957e26442810
Last active Aug 29, 2015
Print Spark Core MAC address
View gist:5ffcf985957e26442810
// 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 <botsnlinux@gmail.com>
// 28 November 2014
SYSTEM_MODE(MANUAL); // We can't connect to the internet anyway...
byte mac[6];
void setup() {