Skip to content

Instantly share code, notes, and snippets.

Avatar

Tyler Hall tylerhall

View GitHub Profile
@tylerhall
tylerhall / MusicCleanupHelper.swift
Created Aug 8, 2021
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.
View MusicCleanupHelper.swift
// 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
View github.css
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 Aug 26, 2020
Fix Catalina SSH Bug
View config
# 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
View Ears-Example.applescript
tell application "Ears"
set audio input "Soundcore Life Q20"
set audio output "iMac Pro Speakers"
end tell
View Ears-CLI-Examples.txt
> 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.
View Example.swift
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 Jan 7, 2020
Find the appropriate SSH tunnel's pid and kill the process
View killSSHTunnel.sh
#!/bin/bash
kill -9 `ps -ax | grep imacvpn | head -n1 | cut -f1 -d " "`
View VirtualHostX-Pro-AppleScript-Example.scpt
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"
View wp-config.php
<?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 Apr 24, 2019
NSOutlineView Drag and Drop with Core Data
View OutlineViewController+Extension.m
- (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>