Skip to content

Instantly share code, notes, and snippets.

@solace
solace / bakesrt.sh
Last active Oct 21, 2021
Bake-in captions into videos using srts and ffmpeg
View bakesrt.sh
#!/bin/bash
# Check out STEAM Powered (https://steampoweredshow.com/) where I have conversations
# with women in STEAM to learn a bit about what they do and who they are.
# https://steampoweredshow.com/learn-more/
# Usage
# =====
#
# Execute script in the directory containing the video and srts files, or modify to take
@solace
solace / plugins--gatsby-remark-cleaner--index.js
Last active Oct 20, 2021
gatsby remark transformer plugin that cleans up extraneous wrapper paragraph tags and table whitespace nodes that can raise errors/warnings.
View plugins--gatsby-remark-cleaner--index.js
const visit = require(`unist-util-visit`);
const remove = require(`unist-util-remove`);
const HTMLParser = require('node-html-parser');
const matches = (classes, value) => {
const fragment = HTMLParser.parse(value);
if (!fragment.firstChild.classList) {
return false;
}
@solace
solace / slurm.conf
Last active Sep 15, 2021
slurm.conf for 16.05.9-1+deb9u
View slurm.conf
###
# WARNING: This config is for development use only.
#
# It was created using https://slurm.schedmd.com/configurator.html and modified
# enough for use on Docker kaldiasr/kaldi with slurm 16.05.9-1+deb9u.
#
# slurm < 20.02.7 is no longer available due to a security vulnerability.
# See: https://www.schedmd.com/archives.php
# Get the latest version and use the configurator from there.
###
@solace
solace / admin.py
Created Jan 3, 2021
django-addanother with django-autocomplete-light and GenericForeignKeys
View admin.py
# Source: https://github.com/yourlabs/django-autocomplete-light/blob/master/test_project/select2_generic_foreign_key/admin.py
import json
from django.contrib import admin
from django.contrib.admin.options import IS_POPUP_VAR, TO_FIELD_VAR
from django.contrib.contenttypes.models import ContentType
from django.template.response import TemplateResponse
from .forms import TForm
@solace
solace / makesrt.py
Last active Sep 21, 2021
Google Cloud Speech-to-Text SRT Generator
View makesrt.py
"""
Check out STEAM Powered (https://steampoweredshow.com/) where I have conversations
with women in STEAM to learn a bit about what they do and who they are.
https://steampoweredshow.com/learn-more/
"""
"""
Requirements
************
@solace
solace / README.md
Last active Nov 22, 2020
Django: augmented user_passes_test to accept params for test_func with matching template tag
View README.md
@solace
solace / migration.py
Created Nov 6, 2020
Django: Add Permissions to Groups during Migration
View migration.py
# YMMV
from django.conf import settings
from django.contrib.auth.models import Group, Permission
from django.core.management.sql import emit_post_migrate_signal
from django.db import migrations, models
import django.db.models.deletion
import logging
@solace
solace / README.md
Created Oct 14, 2020
Custom SVG Definition for @fortawesome/react-fontawesome
View README.md

Usage

Wherever you are initialising the FontAwesome library:

import { library } from '@fortawesome/fontawesome-svg-core';
import faTheName from 'custom-icon';

...
@solace
solace / rule.js
Last active Apr 5, 2021 — forked from vktr/rule.js
Auth0 Rule: Add Stripe Customer Id to existing token data
View rule.js
// If you have multiple rules in your workflow that need to update token data.
function (user, context, callback) {
user.app_metadata = user.app_metadata || {};
const token_namespace = 'https://your-domain.com/app_metadata';
// assumes your metadata object is shallow
const addCustomerId = stripe_customer_id => ({
...context.idToken[token_namespace],
@solace
solace / edl2timeline.py
Last active Sep 21, 2021
Convert DaVinci Resolve marker edl to YouTube usable timeline
View edl2timeline.py
"""
Check out STEAM Powered (https://steampoweredshow.com/) where I have conversations
with women in STEAM to learn a bit about what they do and who they are.
https://www.steampoweredshow.com/learn-more
"""
from pprint import pprint
from collections import OrderedDict
import sys
import re