Skip to content

Instantly share code, notes, and snippets.

@getaaron
getaaron / irs-get-human.md
Created April 1, 2024 23:01
Get a person at the IRS
  • Call 1-800-829-1040
  • Press 1 for English (or other language as desired)
  • Press 2 for personal tax
  • Press 1 for form / tax history
  • Press 3 for other
  • Press 2 for other
  • Ignore 2 SSN prompts till you get secret other menu
  • Press 2 for personal tax
  • Press 3 for other
  • Wait for agent!
@getaaron
getaaron / restart-by-tag.sh
Created June 2, 2023 21:02
Restart multiple Kubernetes deployments by tag
# If you want to restart all k8s deployments by label (e.g. where appname=foo, team=bar, and environ=baz), you can
kubectl get deployments --selector=appname=foo,team=bar,environ=baz | tail -n +2 | cut -d ' ' -f 1 | xargs kubectl rollout restart deployment
@getaaron
getaaron / macos-messages-subject-field.md
Last active January 1, 2024 06:26
Enable iMessage (Messages) Subject Field in macOS Big Sur through Sonoma

Want the Subject field (for bold iMessages) in macOS’ Messages app?

  1. Quit Messages
  2. Open Terminal
  3. Run defaults write com.apple.MobileSMS MMSShowSubject 1
  4. Start Messages

This worked for me on a fresh install of macOS 14.1.1 (23B81) (new Mac mini).

#!/bin/bash
for file in ./*.svg
do
rsvg-convert -h 150 "${file}" > "${file%.svg}"@3x.png
rsvg-convert -h 100 "${file}" > "${file%.svg}"@2x.png
rsvg-convert -h 50 "${file}" > "${file%.svg}".png
done
@getaaron
getaaron / Feature Flag.swift
Created December 15, 2017 20:19
Basic feature flags in Swift
//: # Feature Flag example
//: ## Implementation
import Foundation
enum Feature: String {
case Login, AdminTool
var key: String {
//: Playground - noun: a place where people can play
import Foundation
// this is either a third party SDK interface or your own analytics client implementation
// that actually sends JSON across the wire to deliver tracked analytics events
protocol AnalyticsClient {
func sendAnalyticsDataToTheBackend(_ eventJSON: [String: Any])
}
@getaaron
getaaron / Podfile
Created October 1, 2017 21:48
Xcode 9 Podfile for supporting both Swift 3.2 and Swift 4 Cocoapods
platform :ios, '9.3'
target 'target-name' do
use_frameworks!
pod 'AFNetworking', '~> 2'
pod 'RSBarcodes_Swift', :git => 'https://github.com/yeahdongcn/RSBarcodes_Swift', :branch => 'master'
swift3 = []
swift4 = ['RSBarcodes_Swift'] # if these pods are in Swift 4
@getaaron
getaaron / Fibonacci.swift
Last active January 29, 2017 21:23
Some implementations of a Fibonacci method in Swift
// The correct numbers
let expectedSequence = [1, 1, 2, 3, 5, 8, 13, 21, 34]
// Iterative
func digit(index: Int) -> Int {
var digits = [1, 1]
for i in (2...index) {
@getaaron
getaaron / markdown-anchor.swift
Created February 5, 2016 22:06
Generates RedCarpet-compatible anchor text
import Foundation
extension Character {
var invalid: Bool {
let invalid = Set(" -&+$,/:;=?@\"#{}|^~[]`\\*()%.!'".characters)
return invalid.contains(self)
}
var isAscii: Bool {
guard let number = String(self).utf16.first else { return false }
@getaaron
getaaron / dub.swift
Last active January 31, 2016 03:46
A Swift extension to split a string into an array of strings
extension String {
func split(string: String) -> [String] {
guard !string.characters.isEmpty else { return [string] }
var strings: [String] = []
let targetDistance = string.characters.startIndex.distanceTo(string.characters.endIndex)
var currentIndex = self.startIndex
var currentView = String.CharacterView()