Skip to content

Instantly share code, notes, and snippets.

const YOUTUBE_API = "https://youtube.googleapis.com/youtube/v3"
const API_KEY = "YOUR_KEY_HERE"
const channelIdArray = [
"UCT6iAerLNE-0J1S_E97UAuQ", // YongYea
"UC9PBzalIcEQCsiIkq36PyUA", // Digital Foundry
"UCoTIpyf8_RGzJ1LPTmvadaA", // CENTRAL
"UCNvzD7Z-g64bPXxGzaQaa4g", // gameranx
"UCcGL_0yoZTskvlgAixaEjEg", // whatoplay
"UCawsJGDMV6IOm6z9yiOyIsQ", // Cronosfera
"UC-zfTtp6tir7yJIrpsgS0dA", // Intoxi Anime
@gwthompson
gwthompson / code.py
Created March 24, 2021 03:09 — forked from wildestpixel/code.py
Raspberry Pi Pico & Pimoroni RGB Keypad HID in Circuitpython 6.2+
# Adapted from Sandy J Macdonald's gist at https://gist.github.com/sandyjmacdonald/b465377dc11a8c83a8c40d1c9b990a90 to configure all buttons and switch off all lights in loop
import time
import board
import busio
import usb_hid
from adafruit_bus_device.i2c_device import I2CDevice
import adafruit_dotstar
@gwthompson
gwthompson / Cheerlights.js
Created February 5, 2021 00:56 — forked from anilkpatro/Cheerlights.js
Cheerlights Scriptable script
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: gray; icon-glyph: magic;
// CHEERLIGHTS
// https://cheerlights.com/
// The size of the widget preview in the app - "small", "medium" or "large"
const widgetPreview = "small";
@gwthompson
gwthompson / code.py
Created December 21, 2020 20:52 — forked from dglaude/code.py
Change the MagTag program you want to run at startup.
# This file should be saved as code.py
# At MagTag startup (or at wakeup time), keep one one of the 4 button pressed.
# The MagTag will switch to the program you choose and remember that decision at each wakeup.
# The trick is to have for each button one CircuitPython program to import.
# You can customise the app_to_start list, here is the current setting:
# no button => magtag_weather
# 1 (D15) => magtag_showtimes
# 2 (D14) => magtag_tree
# 3 (D12) => magtag_spacex
# 4 (D11) => magtag_year_progress_percent
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// by @levelsio
// HOW TO
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1
// 2) Publish your Google Sheet, File -> Publish To Web
// 3) Copy the SHEET_ID in the URL, put it in here below:
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json"
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc)
@gwthompson
gwthompson / running.js
Created November 19, 2020 14:44 — forked from matkoenig/running.js
Running Scriptable
// Running 1.0 | Matthias Konig | 02.11.2020
/*------------------------------------------------------------------------------
Hauptprogramm
------------------------------------------------------------------------------*/
// Konstanten
const maxYearDist = 1500;
const maxMonthDist = 200;
const color1 = Color.orange();
@gwthompson
gwthompson / bbc2-playlist.js
Created November 16, 2020 14:16 — forked from marco79cgn/bbc2-playlist.js
A custom iOS widget that shows the last 5 songs from BBC2 radio and plays them in Spotify (for Scriptable.app)
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: red; icon-glyph: music;
// insert your Spotify client id and secret here
const clientId = "xxx"
const clientSecret = "xxx"
let widget = new ListWidget()
widget.setPadding(22,10,10,10)
// These three lines demonstrate how this code works.
let img = await Photos.fromLibrary()
let newImg = await processImage(img)
QuickLook.present(newImg)
// This function takes an image and returns a processed image.
async function processImage(image) {
const imageId = "imageId"
const canvasId = "canvasId"
@gwthompson
gwthompson / DiscordWidget.js
Created October 13, 2020 23:12 — forked from heptal/DiscordWidget.js
Recent Discord channel/DM messages shown in iOS14 widget - built with Scriptable.app
// set up keychain and token
const namespace = "dscrd.wdgt"
const token = `${namespace}.usertoken`
if (!Keychain.contains(token) || !Keychain.get(token)) {
let alert = new Alert()
alert.title = "Enter Discord User Token"
alert.addTextField("<discord_token>")
await alert.presentAlert()
Keychain.set(token, alert.textFieldValue(0) || "")
}
@gwthompson
gwthompson / scriptable.js
Created October 12, 2020 00:53 — forked from danielbuechele/scriptable.js
Covid Widget
const url = `https://api.coronavirus.data.gov.uk/v1/data?filters=areaName=United%2520Kingdom;areaType=overview&latestBy=newCasesByPublishDate&structure=%7B%22date%22:%22date%22,%22value%22:%22newCasesByPublishDate%22%7D`
const req = new Request(url)
const res = await req.loadJSON()
if (config.runsInWidget) {
let widget = createWidget(res.data[0].value, new Date(res.data[0].date))
Script.setWidget(widget)
Script.complete()
}