Skip to content

Instantly share code, notes, and snippets.

View J0hnL0cke's full-sized avatar
:octocat:
:) :) :)

JonasL J0hnL0cke

:octocat:
:) :) :)
View GitHub Profile
@J0hnL0cke
J0hnL0cke / mhtml-to-pdf2.sh
Last active January 20, 2025 22:33
Finds missing pdf files from conversion, then re-fetches them
# Based on my [previous script](https://gist.github.com/J0hnL0cke/95dbf624465034e399592c5d9690eb11) for converting mhtml -> pdf
# This script scans the output directory, in order to figure out if the conversion has failed for any mhtml files
# Instructions
# Install docker
# Set the number on the `tail` commands (in 2 locations now!) to strip file paths (ie "./Readings/filename.mhtml" -> strip first 8 chars -> "filename.mhtml" )
# Run in a directory where you have run `mkdir ./out` and have mhtml files in current folder or subfolders
# To customize where the program searches, for files, edit the path used by the `find` command
IFS=$'\n' &&
@J0hnL0cke
J0hnL0cke / mhtml-to-pdf.sh
Last active January 20, 2025 22:32
Grabs URLs from mhtml files, then converts them to pdf using wkhtmltopdf
# MHTML To PDF Fetcher
# This short bash script opens .mhtml files, finds the original download url, then uses wkhtmltopdf to download a pdf from that site.
# Inspired by the lack of support for .mhtml in e-readers and the lack of options for converting them to other formats.
# Limitations:
# curl cannot use javascript, and thus can't get past anti-scripting protections that use JS redirects
# Because of how `find` escapes special characters, file names with special characters may turn out weird
# Sometimes wkhtmltopdf just gets stuck on a page. Press ctrl+C 3 times to break out of the container and skip to the next one
# Before using:
@J0hnL0cke
J0hnL0cke / main.py
Last active June 8, 2020 18:25
AIY speech-to-text program
#!/usr/bin/env python3
#This is a program for the Google Voice Kit. It uses the Speech Recognition library to send audio snippets to Houndify for interpretation,
#and it uses pyttsx3 to respond to the user
#This program uses code snippets from this example file: https://github.com/Uberi/speech_recognition/blob/master/examples/audio_transcribe.py
#As well as from Google's voice_recorder file: https://github.com/google/aiyprojects-raspbian/blob/aiyprojects/src/examples/voice/voice_er.py
print("Importing libraries...")