Skip to content

Instantly share code, notes, and snippets.

View grantbarrett's full-sized avatar

Grant Barrett grantbarrett

View GitHub Profile
@louis030195
louis030195 / package.json
Last active February 22, 2024 17:01
A 100% local and typescript LLM in Apple Shortcut to be used everywhere on your computer in <1 second
{
"dependencies": {
"@llama-node/llama-cpp": "^0.0.32",
"llama-node": "^0.0.32"
},
"devDependencies": {
"@types/node": "^18.16.3"
}
}
@tjluoma
tjluoma / pdf-rename-by-cdate.sh
Created December 26, 2019 21:55
rename PDF files by their creation date (as determined by PDF metadata)
#!/usr/bin/env zsh -f
# Purpose: rename PDFs by their creation date
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2019-12-26
NAME="$0:t:r"
if [[ -e "$HOME/.path" ]]
@tjluoma
tjluoma / mdpdfpagecount.sh
Created December 24, 2019 04:23
Use `mdls` on macOS to get the number of pages in PDF files
#!/usr/bin/env zsh -f
# Purpose: count PDF pages with a variety of tools
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2019-12-23
NAME="$0:t:r"
if [[ -e "$HOME/.path" ]]
@tjluoma
tjluoma / rename-files-by-filetype.sh
Created October 4, 2019 04:47
use 'file' command to make sure files have the proper (expected) extension
#!/usr/bin/env zsh -f
# Purpose: use 'file' command to make sure image files have proper extension
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2019-10-04
NAME="$0:t:r"
if [[ -e "$HOME/.path" ]]

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

#!/usr/bin/env python3
'''
calisuck: index, filter-out smartly and download ebooks from Calibre open directories
Installation:
You need python 3.5 installed
Download the file as a zip and unzip-it and get into the dir

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable
@elfsternberg
elfsternberg / remove-watermark.sh
Created August 4, 2017 17:48
Remove a textual watermark from a PDF file.
#!/bin/bash
# Remove a textual watermark from a PDF file. Requires qpdf and pdftx
# to work correctly. The correct usage is
#
# remove-watermark WATERMARK "Your Input File.pdf" "Your Output File.pdf"
WATERMARK=$1
INBOUND=$2
OUTBOUND=$3
@jaredatch
jaredatch / how-to.txt
Last active July 20, 2023 17:46
WPForms prevent duplicate / double form entry submissions
<script type="text/javascript">
/**
* Prevent double entry submissions.
*
* Steps to install:
* ​1 - Download and activate the "Insert Headers and Footers" plugin (by WPBeginner)
* 2 - Go to Settings > Insert Headers and Footers
* 3 - Paste this entire code snippet
* 4 - Save
*/
@NeighborGeek
NeighborGeek / import-gvhistory.ps1
Last active April 30, 2024 11:00
Parse Google Voice data exported using Google Takeout to create useful logs of text message and phone calls
<#
.Synopsis
Parses html files produced by Google Takeout to present Google Voice call and text history in a useful way.
.DESCRIPTION
When exporting Google Voice data using the Google Takeout service, the data is delivered in the form
of many individual .html files, one for each call (placed, received, or missed), each text message
conversation, and each voicemail or recorded call. For heavy users of Google Voice, this could mean many
thousands of individual files, all located in a single directory. This script parses all of the html
files to collect details of each call or message and outputs them as an object which can then be
manipulated further within powershell or exported to a file.