Skip to content

Instantly share code, notes, and snippets.

@arturmartins
arturmartins / webvtt2txt.py
Created October 26, 2023 10:53
Converts WEBVTT subtitles (vtt) to plain text.
#!/usr/bin/env python3
"""
Converts WEBVTT subtitles (vtt) to plain text.
It removes all time related info as well as duplicated and empty lines.
"""
# Author: Artur Martins <arturmartins@gmail.com>
# Version: 1.0
# Date: 2023-Oct-25
@hshrews
hshrews / srt_to_txt.py
Last active April 25, 2024 14:25
Python script to convert .srt file to .txt file containing just the text as a data blob.
"""
About:
Looks in the given directory for any .srt (transcript) files to convert to a simple,
single line of text with timestamps and numbered lines removed.
Command line execution:
python srt_to_txt.py <source_directory> <file_encoding>
@:param <source_directory> is the location of the .srt file(s)
@:param <file_encoding> defaults to 'utf-8'
@maxkostinevich
maxkostinevich / index.html
Last active April 21, 2024 06:42
Cloudflare Worker - Handle Contact Form
<!--
/*
* Serverless contact form handler for Cloudflare Workers.
* Emails are sent via Mailgun.
*
* Learn more at https://maxkostinevich.com/blog/serverless-contact-form
* Live demo: https://codesandbox.io/s/serverless-contact-form-example-x0neb
*
* (c) Max Kostinevich / https://maxkostinevich.com
*/
@webdeb
webdeb / Hasura Keycloak.md
Last active October 29, 2022 19:03
Basic Keycloak Script Mapper to provide Hasura claims

Steps to provide Hasura Claims in Keycloak generated JWT

  1. Create your realm / client
  2. Inside client configuration go to "Mappers"
  3. Click on "Create"
  4. Name it "hasura"
  5. Choose Mapper Type "Script Mapper"
  6. Add following script to demonstrate how it works
@tillsanders
tillsanders / README.markdown
Last active October 24, 2022 18:41
How to add a page with all tags to the Casper 2 theme for the Ghost CMS
@glasslion
glasslion / vtt2text.py
Last active May 11, 2024 21:24
This script convert youtube subtitle file(vtt) to plain text.
"""
Convert YouTube subtitles(vtt) to human readable text.
Download only subtitles from YouTube with youtube-dl:
youtube-dl --skip-download --convert-subs vtt <video_url>
Note that default subtitle format provided by YouTube is ass, which is hard
to process with simple regex. Luckily youtube-dl can convert ass to vtt, which
is easier to process.
@tripflex
tripflex / functions.php
Last active September 22, 2023 17:39
How to remove default company fields from WP Job Manager (this example for Listify)
<?php
// Add your own function to filter the fields
add_filter( 'submit_job_form_fields', 'remove_listify_submit_job_form_fields', 9999999999 );
// This is your function which takes the fields, modifies them, and returns them
// You can see the fields which can be changed here: https://github.com/mikejolley/WP-Job-Manager/blob/master/includes/forms/class-wp-job-manager-form-submit-job.php
function remove_listify_submit_job_form_fields( $fields ) {
if( ! isset( $fields['company'] ) ) return $fields;
@ErisDS
ErisDS / examples.md
Last active May 2, 2024 08:23
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

@woogist
woogist / functions.php
Last active February 24, 2019 06:07
The code below adds Sensei support to your Divi Theme. To use it simply copy it to your Divi functions.php file.
/**
* Declare Sensei support
*
* This is needed to hide the Sensei theme compatibility notice your admin dashboard.
*/
add_action( 'after_setup_theme', 'divi_sensei_support' );
function divi_sensei_support() {
add_theme_support( 'sensei' );
}
@don1138
don1138 / font-stacks.css
Last active May 14, 2024 13:16
CSS Modern Font Stacks
/* Modern Font Stacks */
/* System */
font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
/* System (Bootstrap 5.2.0) */
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
/* Times New Roman-based serif */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;