This file contains hidden or 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
# Note: logic in app created via Vibe Coding using ChatGPT. You can review conversation at https://chatgpt.com/share/6852cff0-13a0-800b-8b0d-96a655a387cb | |
# This script converts a pdf of text into a MP3 file. Can be useful to converting long reports into audio files. | |
from gtts import gTTS | |
from PyPDF2 import PdfReader | |
from pydub import AudioSegment | |
import os | |
import sys | |
# === PDF TEXT EXTRACTION === |
This file contains hidden or 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
""" | |
These functions allow you to create mp3 files from YouTube videos. The scripts were created using Vibe coding. | |
You can view the AI conversation at https://chatgpt.com/share/684995e4-aa14-800b-9ce5-f8c74cd34d9a. | |
Backup of conversation located at https://github.com/pmacMaps/pmacMaps.github.io/blob/ec99d84c3c3f88eb6bb1a8c93251f95ed38f2cde/assets/documents/Download_Audio_From_YouTube_ChatGPT_Chat_History.pdf | |
download_playlist_audio: extracts audio from all videos in a playlist | |
download_audio: extracts audio from a single video | |
download_audio_segment: extracts audio from a single video using a start and end time stamp | |
Notes: you will need ffmpeg installed on the machine running this script. |
This file contains hidden or 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
# the majority of the script was created by ChatGPT responding to the prompt "is there a python function that can randomly remove records from a CSV file?" | |
import csv | |
import random | |
import sys | |
def remove_records(input_file, output_file, remove_fraction=0.1): | |
""" | |
Randomly removes a fraction of records from a CSV file. | |
This file contains hidden or 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 arcgis.gis import GIS | |
from arcgis.features import FeatureLayerCollection | |
from print_errors import print_exception # helper module to printing error messages | |
from time import strftime as format_time | |
from time import sleep | |
def optimize(portal_url, username, password, item_id, lyr_idx, req_timeout=180): | |
""" | |
portal_url = URL for GIS portal; string | |
username: username of administrative user to portal; string |
This file contains hidden or 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
# see https://developers.arcgis.com/rest/enterprise-administration/portal/export-site.htm | |
# import modules | |
from arcgis.gis import GIS | |
from os import environ | |
from os import path | |
from datetime import date | |
import logging | |
import sys | |
import requests |
This file contains hidden or 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
rem turn off console printing | |
@echo off | |
rem set variables for date components (used in log file name) | |
For /f "tokens=2-4 delims=/ " %%a in ("%DATE%") do ( | |
SET YYYY=%%c | |
SET MM=%%a | |
SET DD=%%b | |
) |
This file contains hidden or 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 sys | |
import requests | |
import os | |
from urllib.parse import urlparse | |
from bs4 import BeautifulSoup | |
# page containing links to mp3's of songs from Earthbound | |
music_page_url = 'http://starmen.net/mother2/music/' | |
# container for mp3 links | |
mp3_links = [] |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Spinner for Wild Kratts Race Around the World Game</title> | |
<meta name="description" content="A simple spinner app for the Wild Kratts Race Around the World board game."> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta property="og:title" content=""> | |
<meta property="og:type" content=""> | |
<meta property="og:url" content=""> |
This file contains hidden or 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
'use strict'; | |
let shuffleArray = array => { | |
let m = array.length, t, i; | |
// While there remain elements to shuffle | |
while (m) { | |
// Pick a remaining element… | |
i = Math.floor(Math.random() * m--); |
This file contains hidden or 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
# Note: this script is designed to run with Python 3 and ArcGIS Pro ArcPy | |
# import modules | |
# arcpy => provides access to Esri ArcGIS Pro | |
# os => provides convient way to construct file paths | |
# sys => provides way to capture errors | |
# re => used for snake case helper function (taken from https://www.30secondsofcode.org/python/s/snake) | |
import arcpy, os, sys | |
from re import sub |
NewerOlder