Skip to content

Instantly share code, notes, and snippets.

View digiguru's full-sized avatar

digiguru

View GitHub Profile
@digiguru
digiguru / vtt_to_flat.py
Created March 14, 2024 21:02
A simple script that will read the contents of a VTT file (transcript from zoom) and turn it into a simple script between the people talking.
import re
import sys
def parse_vtt_to_flat(filename):
try:
with open(filename, 'r', encoding='utf-8') as file:
content = file.read()
# Remove WEBVTT header and empty lines
content = re.sub(r'WEBVTT.*?\n\n', '', content, flags=re.DOTALL)
#!/bin/bash
# Check if enough arguments are passed
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <source_video> <frame_interval> <change_percentage>"
exit 1
fi
# Assign the arguments to variables
SOURCE_VIDEO="$1"
const desiredFonts = ["Quattrocento Sans","Proxima Nova"];
function checkFontUsage() {
// Access the active presentation
var presentation = SlidesApp.getActivePresentation();
var slides = presentation.getSlides();
// Define the desired font
// Iterate through all slides
@digiguru
digiguru / mov_to_gif.sh
Last active September 12, 2023 19:53
A simple service that will take a .mov and search through every frame looking for differences between that frame and the previous and create a gif with 1 frame for every _changed_ image (visually)
#!/bin/bash
# Default values
FRAME_RATE=4 # Default frame rate (every nth frame)
SSIM_THRESHOLD=0.98 # Threshold below which frames are considered different
TARGET_WIDTH="" # Target width for frames in the GIF, empty means original width
TARGET_HEIGHT="" # Target height for frames in the GIF, empty means original height
input_file="" # Input filename
output_gif="" # Output filename
@digiguru
digiguru / sortTable.js
Last active November 7, 2019 14:56
Get a table of links, sort them and output to a table of links.
// Takes an HTML table from a page that may be layed out as follows:
// | Zoe | Brenda | |
// | Adam | Arthur | Bob |
// | Joe | Zoe |
// and lays them out like this
// | Adam | Arthur | Brenda |
// | Bob | Joe | Zoe |
//
var templates = {
table: (data) => `<table class="ms-rteTable-default" width="100%" cellspacing="0">${data}</table>`,
name: Office Online Content Control Issue
description: Test an issue in Office Online.
host: WORD
api_set: {}
script:
content: |
$("#copy").click(() => tryCatch(copy));
$("#paste").click(() => tryCatch(paste));
let xmlContent = null;
/* euclidean GCD (feel free to use any other) */
function gcd(a,b) {if(b>a) {temp = a; a = b; b = temp} while(b!=0) {m=a%b; a=b; b=m;} return a;}
/* ratio is to get the gcd and divide each component by the gcd, then return a string with the typical colon-separated value */
function ratio(x,y) {c=gcd(x,y); return ""+(x/c)+":"+(y/c)}
/* fix it so the shortest side is always first */
function rotatedRatio(x,y) {var bx=x;if(x>y){x=y;y=bx;} return ratio(x,y)}
/* eg:
@digiguru
digiguru / echoDataAfterTime.js
Last active August 29, 2015 14:04
For faking ajax calls in jquery functions I use this...
var echoDataAfterTime = function(echoData, waitTime) {
var dfd = new $.Deferred();
waitTime = waitTime || 1000 * 3; //3 second default (it's long but it proves a point)
console.log("Waiting for " + waitTime/1000 + " seconds");
setTimeout(function () {
console.log("Waited for " + waitTime/1000 + " seconds to return data", echoData);
dfd.resolve(echoData);
}, waitTime);
@digiguru
digiguru / CurrencyInput
Last active December 19, 2015 09:49
We have a budget planner app, and the first thing we ask the user is "What is your wedding budget?". Given an input of various types, I wanted to calculate the intention of the user without having to ask them any further questions. Originally we just did a simple parseInt(input, 10). After a while we noticed users getting the input incorrect. A …
/*jslint plusplus: true */
/*jslint nomen: true*/
/*global $:false, test:false, ok:false, equal:false */
/* brackets-xunit: qunit */
function convertStringToBudget(input) {
"use strict";
var pointReg = /\./g,
commaReg = /\,/g,
initCurrReg = /[£$R€₹]/g,
@digiguru
digiguru / adapter.js
Last active December 16, 2015 02:29 — forked from elijahmanor/adapter.js
/*!
* jquery-win8-deferred - jQuery $.when that understands WinJS.promise
* version: 0.1
* author: appendTo, LLC
* copyright: 2012
* license: MIT (http://www.opensource.org/licenses/mit-license)
* date: Thu, 01 Nov 2012 07:38:13 GMT
*/
(function () {
var $when = $.when;