Skip to content

Instantly share code, notes, and snippets.

@Steve-Tech
Steve-Tech / codec-reader.py
Last active November 12, 2024 21:32
Codec Reader for HTML Video Tags, gets the correct codecs parameter for AV1 and H.264 videos.
import json
import mimetypes
import subprocess
import sys
# Codec Reader for HTML Video Tags by Steve-Tech
# Usage: python3 codec-reader.py [-d] file_name
# Requires ffmpeg and ffprobe to be installed.
#
# Supported Codecs:
@charles-l
charles-l / save_page.py
Last active March 2, 2024 19:57
A python script to save the Firefox Reader view of a page with images. Kind of a personal archive.org tool but using zip and HTML files rather than WARC.
#!/usr/bin/env python3
from bs4 import BeautifulSoup
from readability import Document
import click
from click import echo
import requests
import slugify
import os
@balbuf
balbuf / wordpress-import-update.php
Created October 15, 2016 17:54
Force the WordPress importer to update existing posts instead of skipping them
<?php
/**
* When using the WordPress Importer, update existing
* posts instead of skipping them. Updates content according
* to the import file even if the existing post was updated
* more recently.
*
* To use, drop this file into your /mu-plugins/ folder or
* copy this code into your functions.php file.
@tripflex
tripflex / remove-span-tags-from-html.php
Last active December 3, 2021 10:26
Remove a specific span tag from HTML while preserving/keeping the inside content using PHP and DOMDocument
<?php
$content = '<span style="font-family: helvetica; font-size: 12pt;"><div>asdf</div><span>TWO</span>Business owners are fearful of leading. They would rather follow the leader than embrace a bold move that challenges their confidence. </span>';
$dom = new DOMDocument();
// Use LIBXML for preventing output of doctype, <html>, and <body> tags
$dom->loadHTML($content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$xpath = new DOMXPath($dom);