Skip to content

Instantly share code, notes, and snippets.

View science's full-sized avatar

Steve Midgley science

  • California, USA
View GitHub Profile
@science
science / WirelessTagTempRead.rb
Created April 24, 2023 23:37
For WirelessTag temperature sensors: Force new temp reading on device and then obtain those temp values
# First follow instructions here: https://wirelesstag.net/eth/oauth2_apps.html to obtain Oauth2 credentials/keys
# You should now have an access_token (and a refresh_token). Use the access_token value in var: wtag_api_key below
# The code below pulls temp from the first tag in the tag list. If you have more than one sensor, you may need to adjust this
require 'net/http'
require 'json'
require 'uri'
def request_immediate_postback(wtag_api_key, tag_id)
url = "https://wirelesstag.net/ethClient.asmx/RequestImmediatePostback"
@science
science / autoresponder.js
Created August 2, 2022 21:27
GAppsScript that looks in Calendar to find all day event with keyword, on presence, turns on gmail autoresponder, otherwise turns off autoresponder
function autoReply() {
Logger.log('Script start');
var strCalendarOOFKey = 'OOF';
var strUserEmailToSetVacationOn = 'steve.midgley.mixrun@gmail.com';
// find calendar event
var today = new Date();
var msTodayStart = today.getTime();
var msTodayEnd = today.getTime()+60000; // adding 1 min, but in effect it means start and end on the same day
var unavailableToday = false;
# NOTE: This is sample code that may not include libraries that are required by this method
# This method is just to demonstrate how to do fast imports from STDIN directly to Postgres
# This method was written a long time ago, so it may no longer function as described
# The following code was ripped from a library and not run, so it may not be fully functional as published
module TableLoader
# return each line with the newline value for the platform in question
# we strip any newlines from the end of each line and replace them with
# Ruby "\n" which should be platform specific
def TableLoader::get_line_from_file(file_handle)
@science
science / forward-sms-to-email-twilio
Created July 16, 2019 12:19
Forward SMS from a twilio number to email using SendGrid API
const got = require('got');
exports.handler = function(context, event, callback) {
const requestBody = {
personalizations: [{ to: [{ email: context.TO_EMAIL_ADDRESS }] }],
from: { email: context.FROM_EMAIL_ADDRESS },
subject: `New SMS message from: ${event.From}`,
content: [
{
type: 'text/plain',
@science
science / Handles8.1License.txt
Created July 1, 2016 16:14
Handles license
A. HANDLE.NET PUBLIC LICENSE AGREEMENT (Ver.1)
This Handle.Net Public License Agreement (ver.1) ("License Agreement")
is between Corporation for National Research Initiatives ("CNRI"),
having an office at 1895 Preston White Drive, Reston, VA 20191-5434,
and the Individual or Organization ("Licensee") that has accessed,
installed or otherwise used the software owned by CNRI called
HANDLE.NET® and its included documentation ("HDL Software")
(collectively the "Parties"). Licensee shall be deemed to have entered
into, signed and agreed to be bound by the terms and conditions of
@science
science / json-ld.json
Created June 24, 2016 14:56
JSON-LD definition in json-schema format
{
"title": "Schema for JSON-LD",
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions":{
"context": {
"additionalProperties": true,
"properties": {
"@context": {
"description": "Used to define the short-hand names that are used throughout a JSON-LD document.",
@science
science / cti_credential_schema.json
Created June 24, 2016 14:55
CTI Credential json-schema definition - DRAFT/IN PROGRESS
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "CredentialRegistry Organization metadata",
"type": "object",
"definitions": {
"organization_cti": {
"properties": {
"@type": { "enum": ["cti:Organization"] },
@science
science / registry_data_envelope.json
Created June 24, 2016 14:53
Data envelope that wraps a data resource for management by metadata registry
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Data envelope",
"type": "object",
"definitions": {
"envelope": {
"properties": {
"envelope_type": {
"description": "Defines the type of the envelope. For now, the only accepted value is \"resource_data\"",
@science
science / cti_organization_schema.json
Created June 24, 2016 14:51
JSON-schema definition for organization - DRAFT/IN PROGRESS
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "CredentialRegistry Organization metadata",
"type": "object",
"definitions": {
"organization_cti": {
"properties": {
"@type": { "enum": ["cti:Organization"] },
@science
science / enum.json
Created June 14, 2016 21:14
Sample Enumeration example for schema.org
{
"books": [
{"@bookType": "hardcover",
"title": "Gone with the Wind"
},
{"@booktype": "eBook",
"title": "The Great Gatsby"}
]
}