Skip to content

Instantly share code, notes, and snippets.

View noelleleigh's full-sized avatar

Noelle Leigh noelleleigh

View GitHub Profile
@noelleleigh
noelleleigh / timerOverlay.html
Last active March 20, 2022 00:54
A countdown/countup timer for use with OBS Studio browser source.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Timer</title>
<style>
body {
margin: 0;
@noelleleigh
noelleleigh / ffmpeg_concat.py
Last active December 23, 2023 01:10
Python CLI script for using the concat demuxer in ffmpeg (https://trac.ffmpeg.org/wiki/Concatenate)
import argparse
import logging
import subprocess
from collections.abc import Iterable
from contextlib import contextmanager
from inspect import cleandoc
from pathlib import Path
from tempfile import NamedTemporaryFile
logging.basicConfig()
@noelleleigh
noelleleigh / translateToEnglish.js
Last active September 27, 2019 22:42
Bookmarklet to translate a webpage into English
javascript: (function () {
const remoteScript = document.createElement('script');
remoteScript.src = 'https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit';
remoteScript.type = 'text/javascript';
document.body.appendChild(remoteScript);
const containerElem = document.createElement('div');
containerElem.id = 'google_translate_element';
document.body.insertBefore(containerElem, document.body.firstChild);
const localScript = document.createElement('script');
localScript.type = 'text/javascript';
@noelleleigh
noelleleigh / Upgrade-Npm.ps1
Last active February 8, 2019 21:10
Automate the process of upgrading npm from a Node.js installation managed by nvm-windows.
# Automate npm updating when using nvm-windows
# Installs npm@latest for the current active node install
# Source: https://github.com/coreybutler/nvm-windows/issues/300#issuecomment-368192283
$ErrorActionPreference = "Stop"
# Create a folder in the Temp directory and return it
# Source: https://stackoverflow.com/a/34559554/9165387
function New-TemporaryDirectory {
$parent = [System.IO.Path]::GetTempPath()
$name = [System.IO.Path]::GetRandomFileName()
function makeGraphBase(width, height) {
return Array(height).fill(undefined).map(row => Array(width).fill('⬜'));
};
function makeData() {
return [0, 1, 2, 4, 4, 3];
};
function diff(val, index, array) {
return array[index + 1] - val;
@noelleleigh
noelleleigh / wiggle.js
Last active March 17, 2018 19:55
Parameterized Javascript implementation of https://twitter.com/slimedaughter/status/927729872092270592 just for the hell of it.
/**
* Return an array of objects representing a triangle wave, with a values and direction for each point.
* @param {Number} length - The desired length of the array.
* @param {Number} height - The desired peak value for the wave.
* @returns {Object[]} - Array of objects like `{wiggle: <Number>, wiggle_down: <Boolean>}`.
*/
function makeWiggle(length, height) {
const output = []
let wiggle = 0;
let wiggle_down = false;
@noelleleigh
noelleleigh / undefinedSin.js
Last active June 28, 2017 21:04
Implementation of Alex Yakushev's JavaScript type nightmare (https://twitter.com/unlog1c/status/879421477036183552) feat. a fun pun!
(function undefinedSin() {
// Save the original sine function
const originalSin = Math.sin;
// Encapsulate a scaled sine function
const sinScaled = function sinScaled(value, xScale, yScale) {
return originalSin((value * Math.PI) / xScale) * yScale;
};
// Function that returns a graph formed by the string representation of the input
@noelleleigh
noelleleigh / get_sunbeam.py
Last active October 27, 2017 15:22
Python 3 script for downloading all the pages of the webcomic On a Sunbeam (http://www.onasunbeam.com/). Requires Requests (http://docs.python-requests.org/) and Beautiful Soup 4 (https://www.crummy.com/software/BeautifulSoup/).
#!/usr/bin/env python3
'''Dowload the comic *On a Sunbeam*'''
import shutil
from urllib.parse import urljoin, urlparse
from os.path import basename
import requests
from bs4 import BeautifulSoup
def get_chapter_links(url):
@noelleleigh
noelleleigh / getYahooQuestion.js
Last active November 15, 2017 18:11
Function for extracting the asker, question, and question details from Yahoo Answer question pages.
/** Pass an object with `asker`, `question`, and `details` properties for the given Yahoo Answers
* question page URL to the callback function.
*/
(function getYahooQuestion(url, callback) {
/** Error to throw when a user data ID cannot be found. */
class NoUserDataIdError extends Error {
constructor() {
super();
this.name = 'NoUserDataIdError';
@noelleleigh
noelleleigh / get_middle-earth_music.ps1
Created February 20, 2017 22:00
Download and extract some background music from http://middle-earth.thehobbit.com/
<#
.SYNOPSIS
Download and extract music from http://middle-earth.thehobbit.com/
#>
# Get dmaf JSON file
$dmaf_assets_url = 'http://middle-earth.thehobbit.com/stable.380729695375977266/assets/dmaf_assets/'
$data = Invoke-WebRequest -Uri ($dmaf_assets_url + 'json/dmaf_data.json') | ConvertFrom-Json
# Get the section of JSON that we're interested in