Skip to content

Instantly share code, notes, and snippets.

View prenagha's full-sized avatar

Padraic Renaghan prenagha

View GitHub Profile
@prenagha
prenagha / arq-complete.sh
Last active February 16, 2018 21:27
Arq Backup Complete Marker
#!/bin/bash
#
# Use with Arq Backup www.arqbackup.com
# To write a backup complete marker file to Amazon AWS S3
# Set as backup complete script in Arq settings for the backup destination
# See related script that checks these files arq-check.sh:
# https://gist.github.com/prenagha/c5d6c2ebf3de0a4f61afdf3610e57363
#
arg=$1
if [ -z "${arg}" ]
@prenagha
prenagha / Run in Terminal.scpt
Last active May 27, 2018 00:39
run terminal command and return results directly back to launchbar
--
-- run terminal command and return results directly back to launchbar
-- runs command using applescript which means under /bin/sh
-- switches to user home dir before running script
--
-- take string from LaunchBar and run as command
on handle_string(theText)
try
set cmd to "cd ~ && " & theText
@prenagha
prenagha / safari.css
Created July 31, 2012 14:42
Safari User Stylesheet
html {
zoom: 1.2;
font: 16px Georgia;
}
img, video {
zoom: .8;
}
* {
/* wrap long strings of text without spaces */
word-wrap: break-word;
@prenagha
prenagha / sVim.rc
Last active October 2, 2018 15:15
sVim Safari Extension settings
" sVim Safari Extension settings
" https://github.com/flipxfx/sVim
let scrollstep = 120
" Neat shortcuts
map "v" goToInput
map "c" lastClosedTab
map "e" quit
map "d" createHint
@prenagha
prenagha / LogRetainManager.py
Last active October 31, 2018 16:48
Lambda CloudWatch Log Retention Manager
import boto3
import os
def lambda_handler(event, context):
default_region = os.environ.get('AWS_REGION', 'us-east-1')
retain_days = int(os.environ.get('RETAIN_DAYS', '30'))
session = boto3.Session()
client = session.client('ec2', region_name=default_region)
@prenagha
prenagha / arq-check.sh
Created May 23, 2016 14:03
Arq Backup Check
#!/bin/bash
#
# Use with Arq Backup www.arqbackup.com
# To check backup complete marker files in Amazon AWS S3
# See related script that writes these files arq-complete.sh:
# https://gist.github.com/prenagha/f11e0b800d7f1a5733dab1289febad51
#
set -e
trap 'notify' INT TERM ERR
@prenagha
prenagha / DefaultIndexHTML.js
Created September 2, 2019 15:44
Lambda@Edge to redirect to default HTML page
'use strict';
const path = require('path');
/**
* Redirects URI to default document.
* Any URI without an extension is assumed to be
* a directory reference and will have '/index.html'
* appended to the URI.
* Useful as Lambda@Edge on CloudFront Origin Request event
@prenagha
prenagha / RedirectCanonical.js
Created September 2, 2019 15:45
Lambda@Edge to redirect from non-canonical (example.net) to canonical (example.com)
'use strict';
/**
* Deploy this Lambda@Edge, in Origin Request event,
* to a CloudFront distribution that hosts the
* NON-Canonical domains. It will redirect everything
* to the canonical version of the URL.
* And let CloudFront and browsers cache the redirect.
*/
exports.handler = (event, context, callback) => {
@prenagha
prenagha / Create Gist.scpt
Created January 13, 2014 15:17
Launchbar action to create public gist
--
-- gist support for launchbar
-- 1. install gist client "sudo gem install gist"
-- https://github.com/defunkt/gist
-- 2. login "gist --login"
--
-- use from launchbar as file action, string/search action, or
-- plain action (will take text from clipboard)
-- then will put gist url as launchbar result
-- from there you can Copy it or hit Enter to open in browser
@prenagha
prenagha / eagle-filer-bookmark-export.applescript
Created January 24, 2020 00:52
Eagle Filer export to Bookmark HTML file
#
# Export items from Eagle Filer into standard Netscape bookmark HTML format
# Suitable for importing into other services like Raindrop
# Select all records in Eagle Filer then run this script
#
set _filename to choose file name with prompt "Export Bookmarks" default name "eagle-bookmarks.html"
tell application "EagleFiler"
set _records to selected records of browser window 1
set _file to open for access _filename with write permission
set _lf to ASCII character 10