This is a Hammerspoon snippet to fix the common problem with the AirPods where connecting AirPods to a MacBook forcibly switches the audio input device to the AirPods mic when you have a better mic on it.
brew install hammerspoon| #!/bin/sh | |
| # | |
| # git-delete-merged - delete local branches that have been merged on GitHub | |
| # | |
| # Copyright (c) 2022 Akinori MUSHA | |
| # | |
| # All rights reserved. | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions |
| [alias] | |
| main = "!set -e; p=refs/remotes/origin; if r=\"$(git symbolic-ref $p/HEAD 2>/dev/null)\"; then echo \"${r#$p/}\"; exit; fi; printf %s \"Fixing the broken ref $p/HEAD... \" >&2; if r=\"$(git remote show origin | awk '/^ HEAD branch: /{print $3}')\"; then echo done. >&2; echo \"$r\"; git symbolic-ref \"$p/HEAD\" \"$p/$r\"; else echo failed. >&2; exit 1; fi" | |
| rails-db-rollback = "!sh -ec 'git diff --name-only --diff-filter=A \"${1-$(git main)}\" -- db/migrate | ruby -e \"puts \\$<.read.scan(%r{/([0-9]+)_})\" | sort -r | while read v; do rake db:migrate:down VERSION=$v; done' ." |
| #!/bin/sh | |
| set -ex | |
| sudo rsync -av /Applications/Google\ Drive\ File\ Stream.app/Contents/MacOS/dfsfuse.kext /Library/Extensions/ | |
| sudo kextload /Library/Extensions/dfsfuse.kext | |
| killall Google\ Drive\ File\ Stream || : | |
| while pgrep -q Google\ Drive\ File\ Stream; do | |
| sleep 1 | |
| done |
Moved to knu/azik.
| knu = require("knu") -- https://github.com/knu/hs-knu | |
| -- Switch between Karabiner-Elements profiles as Barrier enters a different host | |
| do | |
| -- Configure Barrier (https://github.com/debauchee/barrier) to output log to ~/Library/Logs/barrier.log | |
| local logFile = os.getenv("HOME") .. "/Library/Logs/barrier.log" | |
| local lineNo = 1 | |
| local host = nil | |
| local defaultProfile = "Default" | |
| local profileForHost = function (host) |
| # frozen_string_literal: true | |
| require 'benchmark/ips' | |
| require 'date' | |
| Benchmark.ips do |x| | |
| x.config(time: 5, warmup: 2) | |
| funcs = [ | |
| ->(a, b) { |
| (with-eval-after-load 'lsp | |
| (defun my-lsp-search-node_modules () | |
| (and buffer-file-name | |
| (lsp-clients-flow-activate-p buffer-file-name major-mode) | |
| (let* ((flow-location "node_modules/.bin/flow") | |
| (root (locate-dominating-file buffer-file-name flow-location))) | |
| (if root | |
| (set (make-local-variable 'lsp-clients-flow-server) | |
| (expand-file-name flow-location root)))))) |
| function unLoad() { | |
| const { events } = this.props; | |
| const { editor } = this.state; | |
| if (!editor) return; | |
| const { change, ...eventsSansChange } = events; | |
| for (const [event, handler] of Object.entries(eventsSansChange)) { | |
| editor.on(event, handler); | |
| } | |
| } |
| #!/bin/sh | |
| set -e | |
| while getopts 'x' opt; do | |
| case "$opt" in | |
| x) | |
| flags=--ignored | |
| ;; | |
| *) |