This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.etree.ElementTree as ET | |
# Parse the XML file and get the root | |
tree = ET.parse('wordpress_export.xml') | |
root = tree.getroot() | |
# Find the <channel> element | |
channel = root.find('channel') | |
total = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from skyfield.api import load | |
from skyfield.framelib import ecliptic_frame | |
from tzfpy import get_tz | |
import pytz | |
def human_moon(lat, lon): | |
ts = load.timescale() | |
# Get the current time in the specified timezone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --background=00000000 makes a transparent background, to make it easier for placement in other materials | |
qrencode -s 60 -l H --background=00000000 -o "output.png" "https://www.asdf.com/querty" | |
pngcrush output.png output_c.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Role-Based Page Editor Limitations | |
* Description: This plugin restricts editing capabilities of specific pages to certain user roles. It dynamically creates roles if they don't exist and assigns them editor capabilities. It then checks if a user with a specific role is trying to edit a page that they're not assigned to, and if so, it removes their editing capabilities for that page. Edit the $role_page_map array to specify which roles can edit which pages. | |
* Version: 1 | |
* Author: Greg R. | |
*/ | |
/* For example you want to make it so that some peolple at your company can edit /subpage/ and all the children under that page, so you can create a user role that restricts them to jus that section of the site. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import cv2 | |
import matplotlib.pyplot as plt | |
from PIL import Image | |
# adjust these variables as necessary | |
dirname = "pix-for-crop" | |
put_dirname = "cropped" | |
simple_crop = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# takes a text file and makes an audiobook of it ex: | |
# ./generate_audiobook.sh input_book.txt | |
# a few notes, | |
# first, you'll need to install edge-tts (pip3 install edge-tts), sox (sudo apt-get install sox), and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run like: | |
# python3 llm_page.py "https://www.cnn.com/2023/12/09/business/cosmcs-mcdonalds-drinks/index.html" | |
# you can optionally pass in a debug flag as the second argument, like: | |
# python3 llm_page.py "https://www.cnn.com/2023/12/09/business/cosmcs-mcdonalds-drinks/index.html" True | |
import json | |
import requests | |
from termcolor import cprint | |
from collections import OrderedDict | |
from readability import Document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Note that the cleaner sends the html to DirtyMarkup for formatting. | |
Example input: | |
<div class=WordSection1> | |
<p class=MsoNormal align=center style='text-align:center'><span | |
style='font-size:16.0pt;line-height:107%;font-family:"Abadi Extra Light",sans-serif'>Test | |
Clean<o:p></o:p></span></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import asyncio | |
from termcolor import cprint | |
from pyppeteer import launch | |
from pyppeteer_stealth import stealth | |
import subprocess | |
def page_content_vaild(page_content): | |
excluded_strings = ["Page Not Found", "Human Verification", "About Lynx"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Loop over all m4b files in the current directory | |
for input in *.m4b | |
do | |
# Print a message indicating the file being processed | |
echo "Processing file $input..." | |
# Use ffmpeg to convert the m4b file to a wav file | |
ffmpeg -i "$input" "${input%.*}.wav" |
NewerOlder