Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hubspot.jersey.dropwizard.managed; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.jaxrs.cfg.JaxRSFeature; | |
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; | |
import com.google.inject.Inject; | |
import com.google.inject.Provider; | |
import com.yammer.dropwizard.config.Environment; | |
import com.yammer.dropwizard.lifecycle.Managed; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// A half-baked approach (not thread-safe, poor disposable management) for creating | |
// aggregate collections from multiple signals of collection mutations. In this | |
// case we are concating multiple mutation streams into a single container. So for | |
// each inner signal we need to offset subsequent splices by the count of preceding | |
// items (which can be recovered by scanning previous splices). | |
// | |
// Example: | |
// | |
// let (first, sink1) = SignalProducer<Splice<Int>, NoError>.buffer() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Similar to `enumerate` but provides the collection's index type | |
// rather than an Int for the position | |
public func iterate<C: CollectionType>(collection: C) -> SequenceOf<(C.Index, C.Generator.Element)> { | |
var index = collection.startIndex | |
// type-inference doesn't want to work without this | |
return SequenceOf { _ -> GeneratorOf<(C.Index, C.Generator.Element)> in | |
return GeneratorOf { | |
if index == collection.endIndex { | |
return nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Randomizable { | |
static func random() -> Self | |
} | |
protocol IntervalRandomizable: Randomizable, Comparable { | |
static func random(interval: HalfOpenInterval<Self>) -> Self | |
static func random(interval: ClosedInterval<Self>) -> Self | |
} | |
extension CGFloat: Randomizable { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private enum Either<T, U> { | |
case Left(Box<T>) | |
case Right(Box<U>) | |
} | |
public func zipWith<T, U, E>(otherSignal: Signal<U, E>)(signal: Signal<T, E>) -> Signal<(T, U), E> { | |
return Signal { observer in | |
var lock = NSRecursiveLock() | |
lock.name = "org.reactivecocoa.ReactiveCocoa.zipWith" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Observes a run loop to detect any stalling or blocking that occurs. | |
/// | |
/// This class is thread-safe. | |
@interface GHRunLoopWatchdog : NSObject | |
/// Initializes the receiver to watch the specified run loop, using a default | |
/// stalling threshold. | |
- (id)initWithRunLoop:(CFRunLoopRef)runLoop; | |
/// Initializes the receiver to detect when the specified run loop blocks for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BitwiseOptions.swift | |
// | |
// Created by Gregory Higley on 11/24/14. | |
// Copyright (c) 2014 Prosumma LLC. All rights reserved. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming the raw byte[] buffer from onPreviewFrame was written at $1 | |
INPUT=$1 | |
# Need preview size since we dumped to a raw file w/out header info | |
SIZE=1280x960 | |
# Converting to JPEG | |
ffmpeg -f image2 -vcodec rawvideo -s $SIZE -pix_fmt nv21 -i $INPUT out.jpeg | |
# Converting to PNG |