Skip to content

Instantly share code, notes, and snippets.

@viking
viking / diet.sql
Last active May 21, 2019 22:58
Utilities for simple nutrition tracking (SQLite)
/* References:
* https://www.fda.gov/food/nutrition-education-resources-and-materials/how-understand-and-use-nutrition-facts-label
* https://www.accessdata.fda.gov/scripts/interactivenutritionfactslabel/factsheets/vitamin_and_mineral_chart.pdf
*/
CREATE TABLE servings (id INTEGER PRIMARY KEY, product TEXT, size TEXT, grams NUMERIC DEFAULT 0, calories NUMERIC DEFAULT 0, total_fat_g NUMERIC DEFAULT 0, sat_fat_g NUMERIC DEFAULT 0, trans_fat_g NUMERIC DEFAULT 0, cholesterol_mg NUMERIC DEFAULT 0, sodium_mg NUMERIC DEFAULT 0, total_carb_g NUMERIC DEFAULT 0, fiber_g NUMERIC DEFAULT 0, total_sugars_g NUMERIC DEFAULT 0, protein_g NUMERIC DEFAULT 0, vitamin_a_mcg NUMERIC DEFAULT 0, vitamin_c_mcg NUMERIC DEFAULT 0, vitamin_d_mcg NUMERIC DEFAULT 0, calcium_mg NUMERIC DEFAULT 0, iron_mg NUMERIC DEFAULT 0, potassium_mg NUMERIC DEFAULT 0, updated_at DATE);
CREATE TABLE diet (id INTEGER PRIMARY KEY, servings_id INTEGER, num_servings INTEGER DEFAULT 0, time_stamp DATETIME);
CREATE VIEW daily_amount AS SELECT strftime('%Y-%
@viking
viking / script.js
Last active May 30, 2022 21:26
Auto-skip commercials in Hulu live TV recorded programs
var huluInt = setInterval(() => {
if (document.querySelector('div.AdUnitView') !== null) {
document.querySelector('.FastForwardButton').click();
setTimeout(() => {
let event = new MouseEvent('pointerenter');
document.querySelector('#web-player-app').dispatchEvent(event);
}, 2000);
setTimeout(() => {
let event = new MouseEvent('pointerleave');
document.querySelector('#web-player-app').dispatchEvent(event);