Skip to content

Instantly share code, notes, and snippets.

View jswright61's full-sized avatar

Scott Wright jswright61

View GitHub Profile
@jswright61
jswright61 / gist:e038e30655ef66c70eb7e1fa8e87eccf
Created March 7, 2023 20:18
AppleScript to OCR a PDF using PDFPenPro
tell application "PDFpenPro"
open theFile as alias
-- Does the document need to be OCR'd?
get the needs ocr of document 1
if result is true then
tell document 1
ocr
@jswright61
jswright61 / level_up.txt
Created March 8, 2022 13:34
Level Up Email Source
Return-Path: <bounces+21996894-1ed0-deleted=example.com@mail.n.convertkit.com>
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
by sloti44n19 (Cyrus 3.5.0-alpha0-4778-g14fba9972e-fm-20220217.001-g14fba997) with LMTPA;
Tue, 08 Mar 2022 01:01:47 -0500
X-Cyrus-Session-Id: sloti44n19-1646719307-794636-5-17851835402845090288
X-Sieve: CMU Sieve 3.0
X-Spam-known-sender: no
X-Spam-sender-reputation: 500 (none)
X-Spam-score: 0.3
X-Spam-hits: BAYES_00 -1.9, HEADER_FROM_DIFFERENT_DOMAINS 0.249, HTML_MESSAGE 0.001,
@jswright61
jswright61 / wordle_stats.html
Last active February 14, 2022 19:13
Wordle Stats Update
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Update Wordle Statistics</title>
<style>
/* Global Styles & Colors */
:root {
--green: #6aaa64;
--darkendGreen: #538d4e;
Name Artist Composer Album Grouping Work Movement Number Movement Count Movement Name Genre Size Time Disc Number Disc Count Track Number Track Count Year Date Modified Date Added Bit Rate Sample Rate Volume Adjustment Kind Equalizer Comments Plays Last Played Skips Last Skipped My Rating Location
Hurt Johnny Cash Trent Reznor Unearthed (Box Set) Country 8142315 216 5 5 15 15 2002 3/23/21, 1:19 PM 3/23/21, 1:19 PM 256 44100 Apple Music AAC audio file 1 3/23/21, 2:03 PM
Hurt Nine Inch Nails Trent Reznor The Downward Spiral Alternative 14368512 373 1 1 14 14 1994 3/23/21, 1:20 PM 3/23/21, 1:20 PM 256 44100 Apple Music AAC audio file
The Man Who Sold the World (Live) Nirvana David Bowie MTV Unplugged In New York (Live) Rock 9718763 261 1 1 4 14 1994 3/23/21, 1:20 PM 3/23/21, 1:20 PM 256 44100 Apple Music AAC audio file
The Man Who Sold the World (2015 Remastered Version) David Bowie David Bowie The Man Who Sold the World (2015 Remastered Version) Pop 9511865 241 1 1 8 9
@jswright61
jswright61 / validate_webhook.rb
Created September 1, 2019 17:26
Validate Github Webhook Signature
require "openssl"
module ValidateWebhook
def validate(payload, shared_secret, signature)
# in case "sha1=" is not stripped off the beginning of signature before calling
signature = signature.sub("sha1=", "")
signature == OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha1"), shared_secret, payload)
end
end
@jswright61
jswright61 / README.md
Last active May 14, 2019 15:00
Bash / Zsh function to create .keep files

Quick little function to add a directory to a project

  1. Assumes it is run from the project root
  2. Creates the directory and all intermediate directories that don't yet exist
  3. Places an empty file, .keep, in the new directory
  4. Adds the directory to .gitignore and excludes the .keep file in the .gitignore
  5. The file type just gets syntax highlighting right - copy the function and add it to you .zshrc or .bash_profile or whatever

This could be easily adapted to be an executable placed in your path

@jswright61
jswright61 / pre-commit
Last active September 16, 2020 23:28 — forked from wacko/pre-commit
Git hook to avoid commit debug lines (binding.pry console.log debugger...)
#!/usr/bin/env ruby
# modified from https://gist.github.com/wacko/62560b45c1d191859d6b
# Added custom phrase, made greps case insensitive
# Validates that you don't commit forbidden keywords to the repo
# You can skip this checking with 'git commit --no-verify'
exit 0 if ARGV.include?('--no-verify')
# Update this list with your own forbidden keywords

Keybase proof

I hereby claim:

  • I am jswright61 on github.
  • I am jswright61 (https://keybase.io/jswright61) on keybase.
  • I have a public key whose fingerprint is 1E47 FB78 6834 C0D7 8F40 9395 CAB9 39BD 9414 414A

To claim this, I am signing this object:

require "sprockets-helpers"
require "closure-compiler"
require "yui/compressor"
require "pry"
module AssetPipeline extend self
def registered(app)
app.set :assets, assets = Sprockets::Environment.new(app.settings.root)
app.set :assets_path, File.join(app.root, "public", "assets")
app.set :assets_precompile, %w(app.js gallery.js salon_suites.js tenant-form.js app.css *.png *.jpg)
@jswright61
jswright61 / health_check_spec.rb
Created March 18, 2015 14:53
Spec file uses wrong db
# spec/lib/trey/youtube/jobs/health_check.rb
require 'spec_helper'
describe 'Trey::Youtube::Jobs::HealthCheck' do
before(:all) do
DB[:youtube_channel_metrics_days].truncate
DB[:youtube_channel_metrics_days] << {channel_id: 'channel1', date: Date.parse('2014-06-02')}
DB[:youtube_channel_metrics_days] << {channel_id: 'channel2', date: Date.parse('2014-01-01')}
DB[:youtube_video_metrics_days].truncate
DB[:youtube_video_metrics_days] << {channel_id: 'channel1', date: Date.parse('2014-05-15'), video_id: 'vid1'}