Skip to content

Instantly share code, notes, and snippets.

View nitobuendia's full-sized avatar

Nito Buendia nitobuendia

View GitHub Profile
@nitobuendia
nitobuendia / index.js
Created August 13, 2020 13:38
Generate Wifi QR Code
// Can be run without npm installation on https://npm.runkit.com/qrcode
const qrcode = require('qrcode');
qrcode.toDataURL('WIFI:S:<SSID>;T:<WPA|WEP|>;P:<password>;;', {width: 500}, (err, url) => {
console.table(url);
});
@nitobuendia
nitobuendia / Code.gs
Created June 1, 2020 14:50
Label to delete gMail threads matching certain search query - Apps Script
/**
* @fileoverview Utility to delete old threads from a search.
* This is an Apps Script code.
*
* Example of usage:
* Go to scripts.google.com and click 'New script'.
* Enable V8, as the code is written with ES6 features.
* Change QUERY_SEARCH values to the gMail search filters
* that matches the emails you want to delete.
* For example: 'label:coding older_than:1m'
@nitobuendia
nitobuendia / Code.gs
Created January 1, 2020 08:16
Integrate Utilities email on Home-Assistant via MQTT
/**
* Fetches utility consumption details from the Utilities email and sends it to Hassio MQTT.
*
* Apps Script on drive.google.com
*/
/* Configuration. */
/** @const {string} URL for MQTT Server API. */
var MQTT_URL = 'https://your-ha-domain:port/api/services/mqtt/publish';
@nitobuendia
nitobuendia / __init__.py
Created August 14, 2019 11:35
Asana Custom Component for Hassio
"""Creates an Asana Tasks sensors."""
@nitobuendia
nitobuendia / Code.gs
Last active April 24, 2020 09:47
Label to delete gMail threads matching a search query - Apps Script
/**
* @fileoverview Utility to delete old threads from a search.
* This is an Apps Script code.
*
* Example of usage:
* Go to scripts.google.com and click 'New script'.
* Enable V8, as the code is written with ES6 features.
* Change QUERY_SEARCH to a gMail search/filter that matches
* the emails you want to delete. For example:
* 'label:coding older_than:1m'
@nitobuendia
nitobuendia / solution.js
Created August 9, 2019 05:18
Solution to the cuddly duddly fuddly wuddly riddle - https://www.youtube.com/watch?v=z-ZEfxAL9SI
function selectEggs(addEgg) {
let blue = 23;
let purple = 33;
let red = 43;
if (addEgg == 'blue') blue++;
else if (addEgg == 'purple') purple++;
else if (addEgg == 'red') red++;
else {
console.log('Must select a colour: blue, purple, red');
@nitobuendia
nitobuendia / __init__.py
Last active November 19, 2021 16:32
Oura API Ring Sleep sensor for Home Assistant (WIP)
"""Oura sleep integration."""
@nitobuendia
nitobuendia / app.py
Last active July 21, 2019 15:22
API Rest Server for Enviro+ (and sensor config for Home Assistant)
import flask
import reader
app = flask.Flask(__name__)
enviro_reader = reader.EnviroReader()
@app.route("/api/all")
def get_all_readings():
@nitobuendia
nitobuendia / hangman.py
Created July 15, 2019 11:38
Hangman game - implemented in Python
"""Runs a Hangman game that can be played via terminal.
Prerequisites:
1. Download the code as hangman.py into any folder.
2. Get a .txt file called 'words.txt' with all the words that you want to include in the game.
>> Example: https://github.com/dwyl/english-words
To play:
- Run `python hangman`
@nitobuendia
nitobuendia / google_docs_image_resizer.js
Created June 7, 2019 11:10
Resizes all images in a Google Docs document to a desired width, while limited to a max size (sizes are in cm).
/**
* @fileoverview Resizes all images in a document to a desired width
* while limited to a max size. Sizes are in cm.
*
* This code is meant to be implemented as a script on a Google Docs
* document: Tools > Script editor.
*
* Once open, paste the code, adjust your desired sizes and run:
* `resizeToDesiredWidth`.
*