Skip to content

Instantly share code, notes, and snippets.

View JamesMcMahon's full-sized avatar

James F McMahon JamesMcMahon

  • VMWare
  • Chicago, IL
View GitHub Profile
@JamesMcMahon
JamesMcMahon / pre-push.sh
Created July 22, 2022 21:08
Pre-push script for local CI
#!/usr/bin/env sh
set -e
echo "Running pre-push hook..."
git fetch
if ! git diff-index --quiet HEAD --; then
echo "Local changes found, please commit or stash"
exit 1
fi
@JamesMcMahon
JamesMcMahon / root-crontab
Last active November 27, 2022 03:18
Pihole Autoupdate Cron
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
@JamesMcMahon
JamesMcMahon / rsync-backup.sh
Last active November 1, 2021 15:27
Remote backup Rsync
#!/usr/bin/env bash
set -e
log_file=$1
local_path=$2
remote_path=$3
time rsync --archive --verbose --new-compress --human-readable --protect-args --progress --exclude=.DS_Store --log-file=rsync_${log_file}.log ${local_path} ${remote_path}
time rsync --checksum --archive --verbose --new-compress --human-readable --protect-args --progress --exclude=.DS_Store --log-file=rsync_${log_file}_checksum-verify.log ${local_path} ${remote_path}
@JamesMcMahon
JamesMcMahon / comparedirs.py
Created February 3, 2020 01:01
Compare directories script I created for my NAS
#!/usr/bin/env python
import os
import sys
def remove_prefix(text, prefix):
if text.startswith(prefix):
return text[len(prefix):]
return text
@JamesMcMahon
JamesMcMahon / toolbox-fix.sh
Last active July 20, 2019 20:00
Fix issue with Jetbrains Toolbox apps
xattr -cr Applications/JetBrains\ Toolbox/
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'tracker_api'
require 'date'
require 'descriptive_statistics'
def calc_running_velocity(last_3_iterations)
if last_3_iterations.size != 3
return nil
@JamesMcMahon
JamesMcMahon / exo-repl-notes.md
Last active October 23, 2022 00:31
Exo Fennel Encounter REPL in Spacemacs - notes

Some notes on getting this to work via Spacemacs,

You need to add the following

(defun dotspacemacs/user-config ()
  (autoload 'fennel-mode "~/.emacs.d/private/local/fennel-mode/fennel-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.fnl\\'" . fennel-mode))
  )
@JamesMcMahon
JamesMcMahon / comparedirs.py
Created March 31, 2018 23:10
Script to compare just directory names
#!/usr/bin/env python
import os
import sys
def remove_prefix(text, prefix):
if text.startswith(prefix):
return text[len(prefix):]
return text
@JamesMcMahon
JamesMcMahon / brew-deps.sh
Created September 10, 2017 22:19
Lists brew dependencies
#!/bin/zsh
brew list | while read cask; do echo -n $fg[blue] $cask $fg[white]; brew deps $cask | awk '{printf(" %s ", $0)}'; echo ""; done
@JamesMcMahon
JamesMcMahon / tracker.highlighter.user.js
Created November 6, 2016 00:20
Tracker Blocked Highlighter
// ==UserScript==
// @name Tracker Blocked Highlighter
// @namespace http://tampermonkey.net/
// @version 0.1
// @author jmcmahon
// @match https://www.pivotaltracker.com/*
// @grant none
// ==/UserScript==
(function() {