Skip to content

Instantly share code, notes, and snippets.

View lordjabez's full-sized avatar
🔧
https://makingofthings.com

Judson Neer lordjabez

🔧
https://makingofthings.com
View GitHub Profile
@lordjabez
lordjabez / transcribe-audio-files.py
Created October 21, 2023 15:23
Transcribe audio files using OpenAI's whisper-1
#!/usr/bin/env python3
import pathlib
import pprint
import sys
import cachier
import openai
@lordjabez
lordjabez / split-audio-file.bash
Created October 21, 2023 01:40
Split audio file
#!/usr/bin/env bash
set -e
audio_filename="${1}"
splits_filename="${2}"
x="00:00:00"
z=0
@lordjabez
lordjabez / output-silences.bash
Created October 21, 2023 01:39
Detect silence in audio files
#!/usr/bin/env bash
set -e
audio_filename="${1}"
silence_length="${2}"
ffmpeg -i "${audio_filename}" -af "silencedetect=d=${silence_length}" -f null - |& awk '/silence_end/ {print $4,$5}' | awk '{S=$2;printf "%d:%02d:%02d\n",S/(60*60),S%(60*60)/60,S%60}'
@lordjabez
lordjabez / backup.bash
Created June 17, 2023 20:52
Compress, encrypt, and backup a folder to S3
#!/bin/bash -e
current_date=$(date "+%Y%m%d")
bucket_name="my-backup-bucket"
backup_filename="/tmp/documents-backup-${current_date}.tgz"
export AWS_PROFILE=backup
aws-refresh-credentials
aws s3 cp "${backup_filename}.gpg" "s3://${bucket_name}/documents/"
@lordjabez
lordjabez / generate-aws-faq-index.py
Created June 13, 2023 16:37
Generate an index of AWS service FAQs
#!/usr/bin/env python3
import boto3
import cachier
import requests
@cachier.cachier()
def get_services():
@lordjabez
lordjabez / terraform-files
Created May 24, 2023 19:45
Run terraform against a set of files
#!/usr/bin/env python3
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument('--files', action='append')
file_arguments, other_arguments = parser.parse_known_args()
@lordjabez
lordjabez / get-access-token.py
Last active May 16, 2023 14:52
Get an OAuth2 access token with Python
#!/usr/bin/env python3
# pip install beautifulsoup4 keyring pyjwt requests
# ./get-access-token.py $auth_domain $client_id $api_name $username
import getpass
import sys
import time
import urllib.parse
@lordjabez
lordjabez / doc-finder.py
Last active May 5, 2023 04:08
Query the Scripps physician API to find available doctors
import json
import requests
url = 'https://www.scripps.org/physicians.json'
params = {
'api': 'provider_search',
'location': 'location-61-scripps-clinic-rancho-bernardo',
'skill': 'synonym-1-primary-care',
'age_group': 'adults',
@lordjabez
lordjabez / export-emails.py
Created March 23, 2023 01:11
Outlook Exporter
#!/usr/bin/env python3
import argparse
import datetime
import getpass
import os
import re
import exchangelib
@lordjabez
lordjabez / aa-seats.py
Last active November 18, 2022 16:44
American Airlines seat viewer
#!/usr/bin/env python3
# This script takes one parameter, an American Airlines flight number.
# It also requires a FlightLabs API key to be stored in FLIGHTLABS_ACCESS_KEY,
# you can get one at https://app.goflightlabs.com/.
# It will lookup additional flight details from the flight number, and then
# open a web page to the AA seat map tool, passing the proper URL parameters
# to view the seat map for the provided flight.