Skip to content

Instantly share code, notes, and snippets.

View prenagha's full-sized avatar

Padraic Renaghan prenagha

View GitHub Profile
@prenagha
prenagha / Copy to iPhone.scpt
Last active February 26, 2024 07:02
Launchbar integration applescript for command-c http://danilo.to/command-c/
--
-- Source: Padraic Renaghan prenagha@renaghan.com https://gist.github.com/prenagha/8372844
--
-- launchbar integration applescript for command-c
-- http://danilo.to/command-c/
--
-- set the variable "theDevice" below as needed to the device name you want to send to
-- Put script in Launchbar actions folder
-- ~/Library/Application Support/Launchbar/Actions
--
@prenagha
prenagha / TimeMachineMonitor.scpt
Last active December 8, 2023 23:16
Applescript to monitor age of last time machine backup and send alert to notification center and email if too old Set it up in launchd to run daily
--
-- Applescript to monitor age of last time machine backup
-- and send alert to notification center if too old
--
set tmLatest to do shell script "/usr/bin/tmutil latestbackup"
set latest to POSIX file tmLatest
set mod_date to modification date of (info for latest)
set file_age to round (((current date) - mod_date) / days)
log "most recent TM backup " & file_age & " days old"
@prenagha
prenagha / pdfpenocr.scpt
Created November 10, 2011 14:57
applescript folder action to have docs ocr'd by pdfpen
--
-- OCR all documents added to a folder
--
on adding folder items to this_folder after receiving added_items
try
repeat with i from 1 to number of items in added_items
set this_item to item i of added_items
set appName to my getAppName()
tell application appName
activate
@prenagha
prenagha / log-retain-manager-policy.json
Last active June 18, 2023 12:44
Set the retention days on any AWS CloudWatch log group that isn't set yet
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "SetLogRetain",
"Effect": "Allow",
"Action": [
"logs:DescribeLogGroups",
"ec2:DescribeRegions",
"logs:PutRetentionPolicy"
@prenagha
prenagha / jamf.md
Created June 16, 2020 01:23 — forked from a7ul/jamf.md
removing all restrictions on jamf managed macos device - Provided you have root access.

REMOVE JAMF RESTRICTIONS ON MAC

REMOVE ONLY RESTRICTIONS

sudo jamf removeMDMProfile removes all restrictions

sudo jamf manage brings back all restrictions and profiles

REMOVE ALL RESTRICTIONS AND DISABLE JAMF BINARIES WHILE KEEPING YOUR ACCESS TO VPN AND OTHER SERVICES

sudo jamf removeMDMProfile removes all restrictions

@prenagha
prenagha / compile-applescript.sh
Created September 8, 2015 00:18
Compile .applescript files to .scpt files. Useful for LaunchBar actions and such.
#!/bin/bash
#
# find all launchbar action .applescript scripts and compile them
#
LBDEV=~/Dev/launchbar
find $LBDEV -type f -name '*.applescript' -print0 | while read -d '' -r APPLESCRIPT
do
echo "Compiling $APPLESCRIPT ..."
SCPT="${APPLESCRIPT%.applescript}.scpt"
/usr/bin/osacompile -o "$SCPT" "$APPLESCRIPT"
@prenagha
prenagha / init.lua
Created September 30, 2016 00:36
Hammerspoon Config File, Hyper Key, Karabiner-Elements
-- hattip https://github.com/lodestone/hyper-hacks
-- hattip https://gist.github.com/ttscoff/cce98a711b5476166792d5e6f1ac5907
-- A global variable for the sub-key Hyper Mode
k = hs.hotkey.modal.new({}, 'F18')
-- Hyper+key for all the below are setup somewhere
-- The handler already exists, usually in Keyboard Maestro
-- we just have to get the right keystroke sent
@prenagha
prenagha / feed.xml
Last active October 4, 2022 15:51
NY Times book feedbin full content error
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:nyt="http://www.nytimes.com/namespaces/rss/2.0" version="2.0">
<channel>
<title>NYT &gt; Books</title>
<link>https://www.nytimes.com/section/books</link>
<atom:link href="https://rss.nytimes.com/services/xml/rss/nyt/Books.xml" rel="self" type="application/rss+xml"/>
<description/>
<language>en-us</language>
<copyright>Copyright 2022 The New York Times Company</copyright>
<lastBuildDate>Tue, 04 Oct 2022 15:40:16 +0000</lastBuildDate>
@prenagha
prenagha / version-check.js
Last active September 7, 2022 18:03
javascript version id comparison
// compare two versions, return true if local is up to date, false otherwise
// if both versions are in the form of major[.minor][.patch] then the comparison parses and compares as such
// otherwise the versions are treated as strings and normal string compare is done
var VPAT = /^\d+(\.\d+){0,2}$/;
function upToDate(local, remote) {
if (!local || !remote || local.length === 0 || remote.length === 0)
return false;
if (local == remote)
@prenagha
prenagha / DebugEvent.js
Created October 16, 2018 22:27
Lambda@Edge CloudFront Debugging Sample Records
'use strict';
/**
* Lambda@Edge to log CloudFront event and context.
* Note: this runs in Lambda@Edge which means it runs in a variety
* of regions, the region closest to the browser making the request.
* So be sure and check other regions if you don't see the logs in
* CloudWatch in the region you normally use.
*
* https://medium.com/@jbesw/postcards-from-lambda-the-edge-11a43f215dc1