Skip to content

Instantly share code, notes, and snippets.

View davidmerrick's full-sized avatar

David Merrick davidmerrick

View GitHub Profile
@davidmerrick
davidmerrick / hide.js
Created May 29, 2020 01:59
SimplePractice toggle self view bookmarklet
// Toggles hidden state of self view when using SimplePractice telehealth
function toggleSelfView(){
var selfView = document.getElementById("publisher")
if (selfView.style.display === "none") {
selfView.style.display = "block";
} else {
selfView.style.display = "none";
}
}
@davidmerrick
davidmerrick / steps.md
Created November 5, 2019 02:45
Fixing Time Machine

When Time Machine inevitably breaks, here's how to fix it.

  1. Try doing First Aid using Disk Utility. Should repair any permissions that are messed up.
  2. Will add 2 next time I run into it :-).
@davidmerrick
davidmerrick / tm-log.sh
Created November 4, 2019 21:40
Time Machine log
#!/bin/sh
# This script shows the previous 12 hours of Time Machine activity, then shows live logs
# Reference: https://superuser.com/questions/1126990/how-to-view-time-machine-log-in-macos-sierra
filter='processImagePath contains "backupd" and subsystem beginswith "com.apple.TimeMachine"'
# show the last 12 hours
start="$(date -j -v-12H +'%Y-%m-%d %H:%M:%S')"
echo ""
@davidmerrick
davidmerrick / cheatsheet.md
Last active October 29, 2019 23:41
Excel Cheat Sheet

Cheat sheet for advanced Excel formulas

Concatenation

Concatenate strings this way:

=A1&” more text”

Absolute reference

@davidmerrick
davidmerrick / cheatsheet.md
Last active October 24, 2019 18:59
GitHub Actions Cheat Sheet

GitHub Actions Cheat Sheet

Actions

Restrict action to just changes to the "public" path:

on: 
  push:
 paths:
@davidmerrick
davidmerrick / README.md
Last active March 7, 2021 21:27
Monitoring disk space with osquery

Goal here is to monitor disk space usage on my parents' iMac, push it to Kinesis, and alert if it hits a certain threshold.

Prerequisites

Set up a Kinesis stream called osquery-firehose.

Steps

  1. Download the config.
  2. Run the command in osquery.sh.
  3. This will log to /var/log/osquery/osqueryd.results.log
@davidmerrick
davidmerrick / osquery.md
Created August 22, 2019 01:08
Useful osquery

Run the osquery shell with osqueryi

Show hard disk space remaining:

select path, type, round((blocks_available * blocks_size *10e-10),2) as gigs_free from mounts where path='/';
@davidmerrick
davidmerrick / templates.md
Last active August 9, 2019 22:41
Useful IntelliJ live templates for Kotlin

Integration test:

@Test(groups = [INTEGRATION_GROUP])
fun `$END$`(){
}

Add Kotlin logging:

@davidmerrick
davidmerrick / localstack.md
Last active August 8, 2019 23:21
Running localstack in Docker

Start localstack with just S3 running on port 4572 in region us-west-2.

docker run -e "SERVICES=s3:4572" -e "DEFAULT_REGION=us-west-2" -p 4572:4572 localstack/localstack

Create an S3 bucket:

aws --endpoint-url=http://localhost:4572 s3 mb s3://test-bucket

@davidmerrick
davidmerrick / cheatsheet.md
Last active July 29, 2019 18:17
Kotlin conversion cheatsheet

Kotlin Conversion Cheatsheet

A cheat sheet to assist in conversion of Java syntax to Kotlin.

CompletableFutures

Convert Java file to Kotlin, then replace the thenApply that gets generated with the correct Kotlin syntax.

Regex: