Skip to content

Instantly share code, notes, and snippets.

@capnslipp
capnslipp / lsregister-remove
Created July 5, 2013 04:07
Removes applications from OS X's filetype association database (LaunchServices).
#!/usr/bin/env bash
# @purpose: Removes applications from OS X's filetype association database (LaunchServices).
# Useful for .apps you'd like around but never want automatically launched. I use it for alpha/beta/developer preview versions that I like to play with, but don't want to commit to yet.
lsregister="/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister" # or `locate -l1 lsregister`
argc=$#
if [ $argc -ne 1 ]; then
scriptname=`basename $0`
@capnslipp
capnslipp / install_dependencies.sh
Last active December 18, 2015 17:49 — forked from kaspermunck/install_dependencies.sh
Quotes. I like quotes. Also, I like accurate constant identifiers. Imagine that.
#!/bin/bash
# run prior to building with XcodeTest to install WaxSim.
# @note: assumed that WaxSim is already present in the repo at WAXSIM_PATH
# I recommend installing a submodule (rather than including WaxSim's source in the repo itself) via something to the effect of `git submodule add git@github.com:jonathanpenn/WaxSim.git Tools/WaxSim`. But you're free to do whatever you want.
WAXSIM_PATH=./Tools/WaxSim/
# install waxsim
cd "$WAXSIM_PATH"
xcodebuild install DSTROOT=/ INSTALL_PATH=/usr/local/bin
@capnslipp
capnslipp / ViewController.m
Created May 13, 2013 05:52
Quick test to find out what happens if an NSMutableArray is changed significantly within a for…in loop. (Modified from the ViewController.m from Xcode's iOS Single View Application project template.)
//
// ViewController.m
// LoopErrorTest
//
// Created by Slipp D. on 5/13/13.
// Copyright (c) 2013 me!. All rights reserved.
//
#import "ViewController.h"
@capnslipp
capnslipp / When Song Finishes, Pause.applescript
Last active December 29, 2022 17:30
Pause Spotify after the current song finishes playing
(*
@author: Slipp Douglas Thompson
@purpose: Pauses Spotify after the current song finishes playing.
@todo: Optimize so it's more efficient.
@usage: Drop a compiled script (a .scpt file, converted with AppleScript Editor if this is a .applescript file) into ~/Library/Scripts/Applications/Spotify.
Ensure than “Show Script menu in menu bar” is enabled (which can be found in the AppleScript Editor preferences).
When playing a song in Spotify and wishing to stop the music when the track finished, choose “When Song Finishes, Pause” from the script menu, and then walk, walk away.
*)
tell application "Spotify"
log "“When Song Finishes, Pause”: player state is " & (player state)
@capnslipp
capnslipp / ActivityMonitor sample text
Created February 16, 2013 20:57
Finder ballin' (2012-02-16)
This file has been truncated, but you can view the full file.
Sampling process 84871 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Finder (pid 84871) every 1 millisecond
Process: Finder [84871]
Path: /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
Load Address: 0x1035a3000
Identifier: com.apple.finder
Version: 10.8.1 (10.8.1)
Build Info: Finder_FE-808001006000000~2
Code Type: X86-64 (Native)
@capnslipp
capnslipp / where_am_i.rb
Created October 18, 2012 22:42
where_am_i: tiny Ruby debugging extension to sum up the current location in the object graph
## encoding: utf-8
## author: Slipp Douglas Thompson <http://slippyd.com/>
class Object
  # notice: it's a verbal statement
  def where_i_am
    object_index = self.object_id
    class_name = self.class.name
    
    class_lineage = begin
HOMEBREW_VERSION: 0.9.2
HEAD: f46569ecdbeef804c5ec38caa0d7464afda6e464
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit nehalem
OS X: 10.6.8-i386
Xcode: 3.2.6
GCC-4.0: build 5494
GCC-4.2: build 5666
LLVM: build 2335

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
@capnslipp
capnslipp / git-lf
Last active June 28, 2023 19:37
Lost & Found for Git: tag all dangling commits, for those wonderful “oh shit” moments (and cleanup those tags after recovered the lost path)
#!/usr/bin/env bash
# Tags all dangling commits in a Git repo (for the wonderful “oh shit” moments).
# @from: https://gist.github.com/capnslipp/2656868
git fsck --lost-found #--no-reflogs --full --root --cache --tags --unreachable
find '.git/lost-found/commit' -type f | while read i; do
commit_sha=`cat "$i"`
git tag -f "git-lf/commit/$commit_sha" $commit_sha
done
@capnslipp
capnslipp / gist:2639182
Created May 8, 2012 20:54
Markdown Rendering Tests

Fixed-Width Formatting

backticks:
this should have _emphahsees_
this should have **teh strongs**

<code> tag:
this should have emphahsees
this should have teh strongs