Skip to content

Instantly share code, notes, and snippets.

View alderete's full-sized avatar

Michael A. Alderete alderete

View GitHub Profile
@jasonsnell
jasonsnell / weather graph.js
Created July 4, 2024 19:45
Weather graph widget for Scriptable
// Based on code by Efrén Gámez <https://gist.github.com/ImGamez/a8f9d77bf660d7703cc96fee87cdc4b0>
// and modified by Max Zeryck <https://talk.automators.fm/t/widget-examples/7994/217>
// this version by Jason Snell. parsing weatherkit data directly is beyond the scope of this widget;
// it loads a dumped weatherkit JSON from a remote server. Supply your own.
// This widget also loads live data from a weather station, again in a custom format.
// You will need to replace both of these data sources in order to get weather other than mine.
const highTemps = [ ]
const dailyConditions = [ ]
@gruber
gruber / Split Tabs to New Window.scpt
Last active May 5, 2024 16:58
An AppleScript for Safari to move all tabs in the frontmost window, from the current tab to the rightmost (last) tab, to a new window.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
(*
Original script: John Gruber (https://daringfireball.net/linked/2023/12/05/an-applescript-for-safari-split-tabs-to-new-window)
Much more elegant version: Leon Cowle (https://github.com/leoncowle)
Even more elegant version: https://stackoverflow.com/questions/54066100/applescript-to-split-safari-tabs-into-new-window/54089865#54089865
Worth a warning: "moving" tabs with this script doesn't actually move them like
drag-and-drop does. The tabs "moved" by this script will reload in the new window,
@jasonsnell
jasonsnell / weatherkit-sampleproject.py
Last active June 25, 2024 00:07
WeatherKit API sample
#! /usr/bin/env python3
import time
import jwt
import json
import requests
from datetime import datetime
from collections import defaultdict
import matplotlib.pyplot as plt
@jasonsnell
jasonsnell / podcast-noter.scpt
Last active October 27, 2022 15:33
Podcast Noter AppleScript
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
# Sample Keyboard Maestro macros at
# <https://sixcolors.com/wp-content/uploads/2022/01/Podcast-Noter-Macros.kmmacros.zip>
on run argv
try
set theNote to (item 1 of argv)
on error
@kepano
kepano / obsidian-web-clipper.js
Last active November 30, 2024 10:58
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UnifiedBar</key>
<dict>
<key>DisclosureRequired</key>
<string>ace440ac-b4f6-4b43-aade-02bba1589aef</string>
<key>Enabled</key>
<false/>
@JoshStark
JoshStark / convert_audible.sh
Last active June 18, 2021 06:28
A script which combines audible-cli and update_chapter_titles.py to create a 1-1 m4b file from an aax file.
#!/bin/bash
# This script has a few pre-requisites:
#
# 1. The audible-cli must be installed and available in the $PATH.
# https://github.com/mkb79/audible-cli
# e.g. export PATH=$PATH:/home/$(whoami)/.local/bin
#
# 2. The update_chapter_titles.py must also be present in the same
# directory as this file. This also relies on python3 being in the $PATH
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active December 4, 2024 02:32 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export your tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

#!/usr/bin/perl
# This filter changes all words to Title Caps, and attempts to be clever
# about *un*capitalizing small words like a/an/the in the input.
#
# The list of "small words" which are not capped comes from
# the New York Times Manual of Style, plus 'vs' and 'v'.
#
# 10 May 2008
# Original version by John Gruber:
@palkan
palkan / gist:31a70fd45b2b43024370
Created February 3, 2015 08:15
Convert all audio files within directory to MP3 (320) with FFMPEG
#!/usr/bin/env ruby
CONVERT_COMMAND = "ffmpeg -i ':input' -vn -ar 44100 -ac 2 -ab 320 -f mp3 ':output'"
def is_audio?(filename)
filename =~ /\.(wav|flac|aac)$/
end
def extract_name(filename)
File.basename(filename, File.extname(filename))+".mp3"