Skip to content

Instantly share code, notes, and snippets.

@DusanBrejka
DusanBrejka / fluent-ffmpeg-custom-args.js
Last active Sep 20, 2021
node-fluent-ffmpeg - Execute Custom FFMPEG arguments hack
View fluent-ffmpeg-custom-args.js
/*
As at the time of writing this Fluent ffmpeg-API for node.js has not been updated
for years and still does not support custom FFMPEG attributes, the only solutions
are either forking it or resorting to hacks like this one...
Please use it only when fluent does not support more complex arguments
(like generating multi-rendition HLS with all playlists in a single command)
NOTE: this does not support 'progress' event, but you can do it easily by
parsing 'stderr' event with extractProgress method from fluent-ffmpeg/lib/options.js
@odbol
odbol / json_lines.js
Created Aug 27, 2019
Parse JSON Lines file in the browser with Javascript. http://jsonlines.org/
View json_lines.js
function parseJsonLines(file) {
let results = [];
for (let i = 0; i < file.length;) {
const end = file.indexOf('\n', i);
if (end < 0) {
end = file.length;
}
const currentLine = file.substring(i, end);
@mayneyao
mayneyao / notion2blog.js
Last active Nov 22, 2021
Notion.so > Personal Blog | custom domain + disqus comment
View notion2blog.js
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@alixnovosi
alixnovosi / load-alttp-randomizer-spoilers.py
Last active Apr 15, 2020
OBS Studio Python script to load ALttP Randomizer JSON spoilers and process them into OBS text elements.
View load-alttp-randomizer-spoilers.py
# Copyright (c) 2019, Andrew Michaud
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@hinchliff
hinchliff / c7n_run.py
Created Apr 19, 2019
Run a Cloud Custodian policy file from a Python script. Most useful perhaps to be able to run Cloud Custodian from AWS Lambda.
View c7n_run.py
import os
import logging
from c7n.commands import run
from c7n.config import Config
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# Capture our current directory
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
@Hegemege
Hegemege / hue_shift.py
Last active Feb 27, 2021
OBS Hue Shift over Time
View hue_shift.py
# How to use this script in OBS:
# You need Python 3.6 installed
# 1. Open OBS > Tools > Scripts
# 2. Copypaste the Python 3.6 install directory into Python Settings tab.
# 3. Download this file onto your computer and put it somewhere safe
# 4. Add the script to the list of Loaded Scripts by clicking the + at the bottom left
# 5. Select the script from the list and select the correct output source you want to apply the effect to.
# If you can't find the correct source, scroll to the bottom of the file to see if your source is filtered out
# The source you selected must have a Color Correction filter, that has been renamed to "Hue Shift".
# The script won't work otherwise. I couldn't figure out how to list all the filters in a dropdown because
@devdbrandy
devdbrandy / app.js
Created Dec 5, 2018
Simple Express API
View app.js
/* eslint-disable */
const express = require('express');
const app = express();
app.use(express.json());
const db = {
users: [
View README.md

chrome-headless-fetch-charset.js

Fetch pages using a headless chromium browser, and returns the detected charset.

Input file format

Text file, one URL per line

Output file format

View azure-tts.js
var azureCognitiveServicesMainEndpoint = 'https://northeurope.tts.speech.microsoft.com/cognitiveservices/v1';
function azureCallApi(text, callback) {
var ssml = "<speak version='1.0' xmlns=\"http://www.w3.org/2001/10/synthesis\" xml:lang='en-US'>" +
"<voice name='Microsoft Server Speech Text to Speech Voice (en-GB, George, Apollo)'>" +
"<prosody rate=\"slow\">" +
text +
"</prosody>" +
"</voice>" +
"</speak>";
@miabrahams
miabrahams / FfmpegPostprocess.py
Last active Jan 10, 2021
Ffmpeg post-processing OBS Plugin
View FfmpegPostprocess.py
import obspython as obs
import subprocess
import os
import re
import datetime
# Info for potential OBS Python hackers!
# Tip 1 - Read the "OBS Studio Backend Design" documentation page. Read the documentation table of contents.
# Tip 2 - be sure to add obspython.py to your script path to enable completion.
# Tip 3 - Some of the Python API is generated at runtime, so it won't show up in obspython.py.