Skip to content

Instantly share code, notes, and snippets.

View ChristopherA's full-sized avatar

Christopher Allen ChristopherA

View GitHub Profile
@ChristopherA
ChristopherA / iMovieNetworkVolumeSave.md
Created July 12, 2014 21:00
How to modify Mac OSX iMovie to save projects to a network volume via terminal shell defaults write command

Saving iMovie Projects to Network Volumes

The problem

Apple's iMovie saves its Projects and Events files as folders named "/Documents/Movies/iMovie\ Events", "/Documents/Movies/iMovie\ Projects". You are not able to change this location using the app, however, you can use iMovie to move these folders to an external drive. On that drive, both of these folders MUST be at the root, i.e. "/Volumes/Footage/iMovie\ Events" and "/Volumes/Footage/iMovie\ Projects". If you open iMovie while an external drive has these folders at root, iMovie will automatically add them to its event and project library.

Unfortunately, you can't do this trick with network volumes by default. You can do some tricks with symlinks but when using them across volumes they are unreliable and iMovie will loose track of information.

The solution

@ChristopherA
ChristopherA / MavericksSetupAssistantReInstall.txt
Last active August 29, 2015 14:05
Mac OSX Mavericks Setup Assistant Reinstall
Boot into single-user mode (hold ⌘-S during startup)
Once the command-line prompt appears, type the following:
mount -uw /
rm -R /Library/Preferences/
rm -R /Users/your username/
cd /var/db/dslocal/nodes/Default
ls to list the files
@ChristopherA
ChristopherA / MacOSXYosementDevelopmentInstall.md
Last active June 5, 2019 15:30
Initial install for Mac OX 10.10 Yosemite as a development system, with Xcode, Brew, RVM, Cocoapods, etc.

Mac OSX 10.10 Yosemite Development Install

THIS IS A WORK IN PROGRESS USING THE YOSEMITE BETA - DO NOT RELY ON IT!

Fresh Install

Install OSX on a fresh drive. I recommend using Disk Utility to repartition the entire drive as 1 partition, as this clears any hidden volumes.

Once the initial install is complete, the OSX Setup Assistant will create your first adminstrator account.

@ChristopherA
ChristopherA / gist-backup.py
Last active May 31, 2021 22:16
Clone or update all the GitHub gists of the current GitHub user into working directory
#! /usr/bin/env python
# Clone or update all the GitHub gists of the current GitHub user into working directory
# Originally forked from
# https://gist.github.com/joneskoo/1480022
# via https://gist.github.com/nicerobot/1622504
# https://gist.github.com/fedir/5466075
# https://gist.github.com/proski/a31d49380a38d2c45b2f
# Specify GitHub username in the GITHUB_USER environment variable, i.e.
@ChristopherA
ChristopherA / shell-trivialities.md
Last active August 29, 2015 14:06
Bash Shell Trivialities — Short Useful Commands for the OSX Shell

Bash Shell Trivalities: Short Useful Commands & Recipes for the OSX Shell

I find returning to terminal after a break from programming that the simple things sometimes are lost. This document's goal is to capture these, even if otherwise trivial.

Count visible files in folder

$ /bin/ls . | wc -l

Count all files, visible and hidden in folder

@ChristopherA
ChristopherA / .bash_profile.local
Last active August 13, 2016 20:42
.bash_profile.local — loaded by ~/.bashrc for private data, an example for my github.com/christophera/dotfiles project
#!/bin/bash
# ~/.dotfiles/.brewfile_local.sh -- loaded by ~/.bashrc for private data,
# an example for my github.com/christophera/dotfiles project
#
# ~/.bash_profile.local is sourced by ~/.bashrc for shell code which will be
# .gitignored and thus not be backed up into the .dotfiles repository.
# Load on a new machine via:
@ChristopherA
ChristopherA / githubtips.md
Last active April 20, 2020 01:50
Git & Github tips

Git & Github Tips

How to restore a file to last version

Assuming you did not git add the file to the index, or git commit the file, then:

git checkout filename

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch

@ChristopherA
ChristopherA / nozoomheader.html
Created July 12, 2015 03:50
mobile html no zoom
<meta content="width=device-width, initial-scale=1.0 maximum-scale=1.0 user-scalable=0" name="viewport" />
<meta content="apple-mobile-web-app-capable" content="yes" />