Skip to content

Instantly share code, notes, and snippets.

View kevinkirkup's full-sized avatar

Kevin S Kirkup kevinkirkup

  • Digital Realty Trust
  • Raleigh, NC
View GitHub Profile
@kevinkirkup
kevinkirkup / gist:e061a244e8133ff450b7965bdea8cecb
Last active September 9, 2018 02:41
Install OpenCV with Homebrew on macOS Sierra
#!/usr/bin/sh
# https://github.com/Homebrew/homebrew-science/issues/4104
brew reinstall opencv3 --HEAD --with-ffmpeg --with-tbb --with-contrib
# Since this is keg only, create a pth file to include the python bindings in the python path
echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth
mkdir -p /Users/<user>/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/<user>/Library/Python/2.7/lib/python/site-packages/homebrew.pth
#!/usr/bin/bash
# J switch uses xz compression
XZ_OPT=-9 tar cJf tarfile.tar.xz <directory>
@kevinkirkup
kevinkirkup / nth-commit.sh
Created February 5, 2016 04:05 — forked from airdrummingfool/nth-commit.sh
Checkout the nth commit on a specified branch.
#!/bin/bash
# nth-commit.sh
# Usage: `nth-commit.sh n [branch]`
branch=${2:-'master'}
SHA1=$(git rev-list $branch | tail -n $1 | head -n 1)
git checkout $SHA1
@kevinkirkup
kevinkirkup / update_build_number.sh
Created February 5, 2016 04:04 — forked from airdrummingfool/update_build_number.sh
Update current Xcode target's build number with the number of commits on a specified branch. http://tgoode.com/2014/06/05/sensible-way-increment-bundle-version-cfbundleversion-xcode/
#!/bin/bash
# update_build_number.sh
# Usage: `update_build_number.sh [branch]`
# Run this script after the 'Copy Bundle Resources' build phase
# Ref: http://tgoode.com/2014/06/05/sensible-way-increment-bundle-version-cfbundleversion-xcode/
branch=${1:-'master'}
buildNumber=$(expr $(git rev-list $branch --count) - $(git rev-list HEAD..$branch --count))
echo "Updating build number to $buildNumber using branch '$branch'."
// Create an enum for the tags specified in IB
enum TabItems : Int {
case FirstTab = 0
case SecondTab
case ThirdTab
}
// Use a switch to handle each item
for item in self.tabBar.items {
@kevinkirkup
kevinkirkup / SwiftAutolayoutSizeClasses.swift
Created November 24, 2015 12:18
How to adjust layouts based on Autolayout Size Classes
#!/usr/bin/swift
# Take from Apple Sample Code
# https://developer.apple.com/library/prerelease/ios/samplecode/AdaptivePhotos/Listings/AdaptiveCode_AdaptiveCode_OverlayView_swift.html
class SomeView: UIView {
override func intrinsicContentSize() -> CGSize {
var size = label.intrinsicContentSize()
@kevinkirkup
kevinkirkup / gist:67c5a658353ff0ce95fd
Created November 20, 2014 02:35
Run Ansible playbook for a specific user on OSX
# Use Paramiko or we will get an error on Mavericks
ansible-playbook --limit my-desktop site.yml -u <user> --ask-pass --ask-sudo -c paramiko
@kevinkirkup
kevinkirkup / Update Build Number build step
Last active August 29, 2015 14:06
Xcodex Update Build Number build step
#!/usr/bin/env bash
#
# Set the build number to the current git commit count.
# If we're using the Dev scheme, then we'll suffix the build
# number with the current branch name, to make collisions
# far less likely across feature branches.
# Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/
#
git=`sh /etc/profile; which git`
@kevinkirkup
kevinkirkup / version_parser.py
Last active August 29, 2015 14:03
Generate Version number with Python
#
# Taken from:
# https://github.com/fusionbox/django-authtools
#
import subprocess
version = (0, 2, 0, 'alpha')