Skip to content

Instantly share code, notes, and snippets.

View brianfoshee's full-sized avatar
😎

Brian Foshee brianfoshee

😎
View GitHub Profile
@lisamelton
lisamelton / transcode-video.sh
Last active September 8, 2023 23:51
Transcode video file (works best with Blu-ray or DVD rip) into MP4 (or optionally Matroska) format, with configuration and at bitrate similar to popular online downloads.
#!/bin/bash
#
# transcode-video.sh
#
# Copyright (c) 2013-2015 Don Melton
#
about() {
cat <<EOF
$program 5.13 of April 8, 2015
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@mattt
mattt / uiappearance-selector.md
Last active March 19, 2024 12:52
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@maddox
maddox / server.rb
Last active April 8, 2018 01:56
Just some experimentation in creating a live transcoding HTTP Live Streaming server for accessing an HDHomeRun
ffmpeg -i http://PRIMEIP:5004/auto/v1004 -async 1 -ss 00:00:05 -acodec libfdk_aac -vbr 3 \
-b:v \3000k -ac 2 -vcodec libx264 -preset superfast -tune zerolatency -threads 2 -s 1280x720 \
-flags -global_header -map 0:0 -map 0:1 -f segment -segment_time 10 -segment_list stream.m3u8 \
-segment_format mpegts -segment_wrap 10 -segment_list_size 6 -segment_list_flags live stream%03d.ts
@robinsloan
robinsloan / langoliers.rb
Last active April 7, 2024 13:22
The Langoliers, a tweet deletion script
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 5, 2024 13:30
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
@lxcid
lxcid / gist:2586763
Last active October 4, 2015 05:38
Call resume() to stop the block from exercising the run loop and break out of the loop/block. Failure to call resume() will cause the test to hang indefinitely. This is useful to testing asynchronous actions like AFNetworking operations. See https://gist.github.com/2215212 With some reference from https://github.com/icanzilb/MTTestSemaphore, I w…
typedef void (^LXSResumeBlock)(void);
typedef void (^LXSRunLoopBlock)(LXSResumeBlock resume);
// Call resume() to stop the block from exercising the run loop and break out of the loop/block.
// Failure to call resume() will cause the test to hang indefinitely.
// This is useful to testing asynchronous actions like AFNetworking operations. See https://gist.github.com/2215212
// With some reference from https://github.com/icanzilb/MTTestSemaphore, I was able to simplify this method.
inline void LXS_exercisesRunLoopInBlock(LXSRunLoopBlock block) {
__block BOOL keepRunning = YES;
block(^{ keepRunning = NO; });
while (keepRunning && [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.03]]) {
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@shawnwall
shawnwall / gist:2215212
Created March 27, 2012 11:41
Unit testing blocks with AFNetworking example
/*
* SenTestingKit does not wait for blocks to finish by default so your test would simply complete
* as successful. You need to use a semaphore and keep the run loop going in order for the test
* to properly run.
*/
- (void)testGetSpots {
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
CLLocation location = [[CLLocation alloc] initWithLatitude:70.0 longitude:50.0];
[Spot spotsWithURLString:@"/spots" near:location parameters:[NSDictionary dictionaryWithObject:@"128" forKey:@"per_page"] block:^(NSArray *records) {
//sample assert
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];