Skip to content

Instantly share code, notes, and snippets.

View tylerhall's full-sized avatar

Tyler Hall tylerhall

View GitHub Profile
@tylerhall
tylerhall / MusicCleanupHelper.swift
Created August 8, 2021 15:06
Trying to cleanup my music library this morning. It was easier to write this script in Swift than try and figure out the equivalent in Bash.
// Trying to cleanup my music library this morning.
// It was easier to write this script in Swift than
// try and figure out the equivalent in Bash.
//
// I'm using this in conjunction with Beets <https://beets.io/>.
//
// Prior to importing music into my library with Beets, this
// script attempts to callout any problematic album folders that:
//
// 1. Contain BOTH .flac and at least one lossy format
body {
font-family: -apple-system, BlinkMacSystemFont, Helvetica, arial, sans-serif;
font-size: 16px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px;
}
@tylerhall
tylerhall / config
Created August 26, 2020 15:27
Fix Catalina SSH Bug
# Solves https://tyler.io/so-uh-i-think-catalina-10154-broke-ssh/
If you add a timeout to your SSH command, it will work.
ssh -p 6789 -oConnectTimeout=10 domain.com
Or, you can automatically apply it to all SSH connections by adding
Host *
ConnectTimeout 10
tell application "Ears"
set audio input "Soundcore Life Q20"
set audio output "iMac Pro Speakers"
end tell
> Ears --help
USAGE: ears [--input <input>] [--output <output>] [--list-outputs] [--list-inputs]
OPTIONS:
-i, --input <input> The audio input device to make current.
The name must be an exact match.
-o, --output <output> The audio output device to make current.
The name must be an exact match.
--list-outputs Show available output devices.
--list-inputs Show available input devices.
var leftExpressions = [
NSExpression(forKeyPath: "pageTitle"),
NSExpression(forKeyPath: "pageDescription"),
NSExpression(forKeyPath: "content"),
NSExpression(forKeyPath: "url")
]
var operatorTypes = [
NSNumber(value: NSComparisonPredicate.Operator.equalTo.rawValue),
NSNumber(value: NSComparisonPredicate.Operator.contains.rawValue),
NSNumber(value: NSComparisonPredicate.Operator.beginsWith.rawValue),
@tylerhall
tylerhall / killSSHTunnel.sh
Created January 7, 2020 22:17
Find the appropriate SSH tunnel's pid and kill the process
#!/bin/bash
kill -9 `ps -ax | grep imacvpn | head -n1 | cut -f1 -d " "`
tell application "VirtualHostX"
set devSite to make new website
set devSite's name to "dev-website"
set devSite's local path to "/Users/thall/Sites/tylerio"
apply changes
set urlToOpen to local url of devSite
tell application "Safari"
<?php
if(isset($_SERVER['HTTP_X_ORIGINAL_HOST'])) {
$proto = empty($_SERVER['HTTP_X_FORWARDED_PROTO']) ? 'http' : (($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ? 'https' : 'http');
$url = $proto . '://' . $_SERVER['HTTP_X_ORIGINAL_HOST'];
if($proto == 'https') { $_SERVER['HTTPS'] = 'on'; }
} else {
$s = empty($_SERVER['HTTPS']) ? '' : ($_SERVER['HTTPS'] == 'on') ? 's' : '';
$port = ($_SERVER['SERVER_PORT'] == '80') ? '' : (":".$_SERVER['SERVER_PORT']);
$url = "http$s://" . $_SERVER['HTTP_HOST'] . $port;
}
@tylerhall
tylerhall / OutlineViewController+Extension.m
Created April 24, 2019 20:44
NSOutlineView Drag and Drop with Core Data
- (void)outlineViewItemDidCollapse:(NSNotification *)notification {
VirtualHost *vh = [[[notification userInfo] valueForKey:@"NSObject"] representedObject];
vh.isExpandedValue = NO;
}
- (void)outlineViewItemDidExpand:(NSNotification *)notification {
VirtualHost *vh = [[[notification userInfo] valueForKey:@"NSObject"] representedObject];
vh.isExpandedValue = YES;
}
</code></pre>