Skip to content

Instantly share code, notes, and snippets.

View nitobuendia's full-sized avatar

Nito Buendia nitobuendia

View GitHub Profile
@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 / 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 / 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 / __init__.py
Created August 14, 2019 11:35
Asana Custom Component for Hassio
"""Creates an Asana Tasks sensors."""
@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 / 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 / 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 / script.sh
Created October 25, 2020 08:45
Bash to rename files on current directory based on their modified date
for filename in *; do
modified_date=$(date -r ${filename} "+snapshot-%Y%m%d")
extension="${filename#*.}"
mv ${filename} ${modified_date}.${extension}
done
@nitobuendia
nitobuendia / import_ssl_certificates.sh
Created November 2, 2020 14:48
Import SSL certificates into UniFi controller
#!/usr/bin/env bash
################################################################################
# VERSION 1
################################################################################
# UniFi Controller SSL Certificate Import Script for Unix/Linux Systems
# by Steve Jenkins <http://www.stevejenkins.com/>
# Part of https://github.com/stevejenkins/ubnt-linux-utils/
@nitobuendia
nitobuendia / random-boolean-network.ipynb
Last active November 15, 2020 09:46
Random Boolean Network
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.