Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Pretty swamped with work-work

Brad Greenlee bgreenlee

💭
Pretty swamped with work-work
View GitHub Profile
View convert a set of [code_swarm] PNGs to a MOV
ffmpeg -f image2 -r 24 -i ./frames/code_swarm-%05d.png -sameq out.mov -pass 2
View snippet.rb
require 'open-uri'
content = nil
puts "Valid cert:"
open("https://www.wesabe.com") { |s| content = s.read }
puts " got #{content.length} bytes"
puts "Invalid cert: "
open("https://google.com") { |s| content = s.read }
puts " got #{content.length} bytes"
@bgreenlee
bgreenlee / pushups crontab
Created Mar 23, 2010
reminder to do pushups every hour while at work
View pushups crontab
# reminder to do pushups every hour while at work
45 9-17 * * 1-5 /usr/local/bin/growlnotify -m "pushups"
View bsearch.rb
# Taking on the Binary Search challenge
# http://reprog.wordpress.com/2010/04/19/are-you-one-of-the-10-percent/
class Array
# Binary search; assumes array is sorted
# If value is found in the array, it returns an index where it can be found.
# If the value occurs multiple times in the array, it will just return the
# first place it is found (not necessarily the first occurrence in the array).
# If the value is not found, it returns nil.
def bsearch(value)
@bgreenlee
bgreenlee / homevnc.sh
Created Jun 18, 2010
Script to open up a Screen Sharing session in OS X to a home computer over SSH
View homevnc.sh
#!/bin/sh
# port you have open on your home router to forward ssh
SSH_PORT=22022
# set up dynamic dns if you don't have a static ip
HOST=your.home.ip
# OSX Screen Sharing will complain if you try to connect to the standard
# VNC ports (5900+) on localhost, so pick another available port
LOCAL_PORT=1202
View remindme
#!/bin/bash
# Pop up a reminder at given time (or a given amount of time from now)
#
# Usage:
# remindme "Go home" 5pm
# remindme "Move the car" +2 hours
# remindme "Call Bob" tomorrow
#
# For more on possible time formats, 'man at'
View snippet.sh
# install ruby 1.9.2 on OS X
rvm package install readline
rvm package install iconv
rvm install 1.9.2 -C --enable-shared,--with-iconv-dir=$HOME/.rvm/usr,--with-readline-dir=$HOME/.rvm/usr,--build=x86_64-apple-darwin10
@bgreenlee
bgreenlee / xcode_auto_versioning.rb
Created Jan 22, 2011
Xcode Auto-Versioning: Updates your Info.plist's CFBundleVersion with the current git tag and/or sha. #xcode #git
View xcode_auto_versioning.rb
# Xcode Auto-Versioning
#
# Updates your Info.plist's CFBundleVersion with the current git tag and/or sha.
#
# based on https://github.com/elliottcable/xcode-git-versioner
#
# Usage:
# 1. Right-click the target you want to add the versioning phase to (usually the target that builds your app)
# 2. Select: Add -> New Build Phase -> New Run Script Build Phase
# 3. Specify /usr/bin/env ruby as the shell for the script
@bgreenlee
bgreenlee / Versioning.sh
Last active Sep 24, 2015
Automatic project versioning for Xcode using git commits & tags #xcode #git
View Versioning.sh
#!/bin/sh
# Versioning.sh
#
# https://gist.github.com/791352 by Marc Hedlund
#
# Found at http://kswizz.com/post/2686511526/git-xcode-versioning and slightly
# modified.
# To install:
@bgreenlee
bgreenlee / github.com.js
Created Jun 29, 2011
dotjs (http://defunkt.io/dotjs/) script to hide the GitHub one-click merge pull request button, which makes a mess of your repo #github #javascript
View github.com.js
// hide the evil merge button
$("#js-mergeable-clean").hide()