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 / 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 / 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

Keybase proof

I hereby claim:

  • I am prenagha on github.
  • I am prenagha (https://keybase.io/prenagha) on keybase.
  • I have a public key ASC04lRyBGeCmnZDKGqGfErdoTXJCGmx9XgSGdj5Nive8go

To claim this, I am signing this object:

@prenagha
prenagha / micropub-micro-blog-example.sh
Created April 27, 2017 22:03
Micropub sample post to Micro.blog
#!/bin/bash
# http://help.micro.blog/2017/api-posting/
# https://indieweb.org/Micropub
URL="https://micro.blog/micropub"
TOKEN="aabbcc"
CONTENT="Sample Post Here - http://example.com"
curl --verbose \
@prenagha
prenagha / karabiner.json
Created June 14, 2017 03:14
Karabiner Elements Config for Basic vi-style movements and Hyper Key
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"rules": [
@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 / 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
@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 / 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)