Skip to content

Instantly share code, notes, and snippets.

@brandonb927
brandonb927 / osx-for-hackers.sh
Last active June 13, 2024 02:39
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@jasonsnell
jasonsnell / gist:1b728736c636272bc5da
Last active January 18, 2022 22:17
Use this in an Automator action set to accept file input from the command line
for i in "$@" ; do /Users/jsnell/ffmpeg -i "$i" -map 0:0 -acodec pcm_s16le -ac 1 -out_sample_rate 44100 "${i%.*}.wav" ; done
@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@ismyrnow
ismyrnow / mac-clear-icon-cache.sh
Created May 5, 2017 19:28
Clear the icon cache on a Mac when you start seeing generic icons in Finder or the Dock
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder
@joncardasis
joncardasis / MenuBarOptionKeyListener.swift
Created January 5, 2018 17:35
Showing/Hiding Menu Bar Items If OPTION is held down (Swift macOS AppKit)
class AppDeleatate: NSObject, NSApplicationDelegate {
fileprivate var optionalMenuItems = [NSMenuItem]()
//...
func applicationDidFinishLaunching(_ aNotification: Notification) {
//...
let specialItem = NSMenuItem(title: MenuBarItemLabelText.specialItem, action: #selector(doNeatAction), keyEquivalent: "")
specialItem.isHidden = true
optionalMenuItems.append(specialItem)
@chockenberry
chockenberry / Debug.swift
Last active April 11, 2024 13:22
Debug and release logging in Swift that's reminiscent of NSLog()
//
// Debug.swift
//
// Created by Craig Hockenberry on 3/15/17.
// Updated by Craig Hockenberry on 2/20/24.
// Usage:
//
// SplineReticulationManager.swift:
//
struct User: Codable {
var firstName: String
var lastName: String
var lastLogin: Date?
}
@propertyWrapper
struct Storage<T: Codable> {
private let key: String
private let defaultValue: T
@danielpunkass
danielpunkass / RSDimensionHuggingTextField.swift
Last active May 30, 2024 01:08
NSTextField subclasses that grow/shrink their width or height to fit text content
//
// RSDimensionHuggingTextField.swift
// RSUIKit
//
// Created by Daniel Jalkut on 6/13/18.
//
import Cocoa
// You probably want to use one of RSHeightHuggingTextField or RSWidthHuggingTextField, below
@dmthomas
dmthomas / Apple Special Event Sept 2020 1080p, 1440p, 2160p
Last active January 19, 2021 01:28
Apple Special Event Sept 2020 1080p, 1440p, 2160p
#h264 1080p
ffmpeg -i https://p-events-delivery.akamaized.net/1108byjxmnoakagswdphbwatymztxxew/vod/avc_1080p_8500/prog_index.m3u8 -c copy "Apple Special Event, September 2020 (1080p) temp.mp4"
ffmpeg -i https://p-events-delivery.akamaized.net/1108byjxmnoakagswdphbwatymztxxew/vod/audio_english_128/prog_index.m3u8 -c copy "Apple Special Event, September 2020 (1080p) temp.aac"
ffmpeg -i "Apple Special Event, September 2020 (1080p) temp.mp4" -i "Apple Special Event, September 2020 (1080p) temp.aac" -c copy "Apple Special Event, September 2020 (1080p).mp4"
#h265 1080p
ffmpeg -i https://p-events-delivery.akamaized.net/1108byjxmnoakagswdphbwatymztxxew/vod/hvc_1080p_7000/prog_index.m3u8 -c copy "Apple Special Event, September 2020 (1080p) temp.mp4"
ffmpeg -i https://p-events-delivery.akamaized.net/1108byjxmnoakagswdphbwatymztxxew/vod/audio_english_128/prog_index.m3u8 -c copy "Apple Special Event, September 2020 (1080p) temp.aac"
ffmpeg -i "Apple Special Event, September 2020 (1080p) temp.mp4" -i "Apple Special Event,
@dmthomas
dmthomas / Apple Special Event Oct 2020 1080p, 1440p, 2160p
Last active October 21, 2020 21:41
Apple Special Event Oct 2020 1080p, 1440p, 2160p
#h264 1080p
ffmpeg -i https://p-events-delivery.akamaized.net/2109isftrwvmiekgrjkbbhxhfbkxjkoj/vod/avc_1080p_8500/prog_index.m3u8 -c copy "Apple Special Event, October 2020 (1080p) temp.mp4"
ffmpeg -i https://p-events-delivery.akamaized.net/2109isftrwvmiekgrjkbbhxhfbkxjkoj/vod/audio_english_128/prog_index.m3u8 -c copy "Apple Special Event, October 2020 (1080p) temp.aac"
ffmpeg -i "Apple Special Event, October 2020 (1080p) temp.mp4" -i "Apple Special Event, October 2020 (1080p) temp.aac" -c copy "Apple Special Event, October 2020 (1080p).mp4"
#h265 1080p
ffmpeg -i https://p-events-delivery.akamaized.net/2109isftrwvmiekgrjkbbhxhfbkxjkoj/vod/hvc_1080p_7000/prog_index.m3u8 -c copy "Apple Special Event, October 2020 (1080p) temp.mp4"
ffmpeg -i https://p-events-delivery.akamaized.net/2109isftrwvmiekgrjkbbhxhfbkxjkoj/vod/audio_english_128/prog_index.m3u8 -c copy "Apple Special Event, October 2020 (1080p) temp.aac"
ffmpeg -i "Apple Special Event, October 2020 (1080p) temp.mp4" -i "Apple Special Event, October 2020 (1