Skip to content

Instantly share code, notes, and snippets.

View ohookins's full-sized avatar
🤔
Thinking

Oliver Hookins ohookins

🤔
Thinking
View GitHub Profile
@ohookins
ohookins / presto-bootstrap.rb
Created June 7, 2014 22:55
Working PrestoDB bootstrap script on top of EMR
#!/usr/bin/ruby
require 'json'
require 'emr/common'
require 'digest'
require 'optparse'
def println(*args)
print *args
puts
@ohookins
ohookins / SlideView.js
Last active August 29, 2015 14:03
Famo.us slideshow with fade-in/slide/fade-out on each slide
/*** SlideView ***/
// define this module in Require.JS
define(function(require, exports, module) {
// Import additional modules to be used in this view
var View = require('famous/core/View');
var ImageSurface = require('famous/surfaces/ImageSurface');
var Transform = require('famous/core/Transform');
var Modifier = require('famous/core/Modifier');
@ohookins
ohookins / gist:37e8dc49e12ffd71742d
Created September 7, 2014 21:02
Failed attempt at automatically adjusting content surface
// Constructor function for our ContentView class
function ContentView() {
// Applies View's constructor function to ContentView class
View.apply(this, arguments);
var content = TextData['mycontent'];
// Backgrounds
this.add(new Surface({
size: [undefined, undefined],
# Git completions
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
# Show git branch name in prompt
function smiley() {
if [ $? -eq 0 ]; then
echo -en '\033[32m:)\033[00m'
else
echo -en '\033[31m:(\033[00m'
@ohookins
ohookins / gist:3690514
Created September 10, 2012 11:52
S3 Bucket Versioning
1.8.7 :018 > bucket = s3.buckets['oliver-test-versioning']
=> #<AWS::S3::Bucket:oliver-test-versioning>
1.8.7 :026 > bucket.enable_versioning
=> nil
1.8.7 :027 > bucket.versioned?
=> true
1.8.7 :029 > bucket.versions.each { |v| puts v.class }
AWS::S3::ObjectVersion
AWS::S3::ObjectVersion
AWS::S3::ObjectVersion
@ohookins
ohookins / gist:3801137
Created September 28, 2012 17:27
mplayer homebrew build diff for latest release
diff --git a/configure b/configure
index bbfcd51..5734024 100755
--- a/configure
+++ b/configure
@@ -48,8 +48,6 @@ if test -e ffmpeg/mp_auto_pull ; then
fi
if ! test -e ffmpeg ; then
- echo "No FFmpeg checkout, press enter to download one with git or CTRL+C to abort"
- read tmp
@ohookins
ohookins / gist:3801133
Created September 28, 2012 17:25
mplayer homebrew build diff for HEAD
diff -ruN mplayer.orig/configure mplayer/configure
--- mplayer.orig/configure 2012-09-28 16:12:45.000000000 +0200
+++ mplayer/configure 2012-09-28 16:13:10.000000000 +0200
@@ -48,8 +48,6 @@
fi
if ! test -e ffmpeg ; then
- echo "No FFmpeg checkout, press enter to download one with git or CTRL+C to abort"
- read tmp
if ! git clone --depth 1 git://source.ffmpeg.org/ffmpeg.git ffmpeg ; then
@ohookins
ohookins / gist:3819110
Created October 2, 2012 13:25
libfdk_aac vs nero aac
NOT WORKING:
[15:19:42.767] GET http://localhost:5000/media_011012/1mT1O677gwdP-libfdk_aac.mp4 [HTTP/1.1 200 OK 18ms]
[15:19:42.739] JWPLAYERVIEWPLAY ([ViewEvent type="jwplayerViewPlay" data="null" id=mediaplayer1-right client=FLASH MAC 11,4,402,265 version=5.10.2295]) @ http://localhost:5000/
[15:19:42.741] JWPLAYERMEDIABEFOREPLAY ([MediaEvent type="jwplayerMediaBeforePlay" id="mediaplayer1-right" client="FLASH MAC 11,4,402,265" version="5.10.2295"]) @ http://localhost:5000/
[15:19:42.743] JWPLAYERMEDIALOADED ([MediaEvent type="jwplayerMediaLoaded" id="mediaplayer1-right" client="FLASH MAC 11,4,402,265" version="5.10.2295"]) @ http://localhost:5000/
[15:19:42.745] JWPLAYERPLAYERSTATE ([PlayerStateEvent type="jwplayerPlayerState" oldstate="IDLE" newstate="BUFFERING" id="mediaplayer1-right" client="FLASH MAC 11,4,402,265" version="5.10.2295" message="null"]) @ http://localhost:5000/[15:19:42.746] JWPLAYERMEDIABUFFER ([MediaEvent type="jwplayerMediaBuffer" bufferPercent="0" position="0" id="mediaplayer1-right"
@ohookins
ohookins / gist:3910413
Created October 18, 2012 08:15
Chef seems to lack unique resource naming...
root@squeeze:/var/chef/cookbooks/test/recipes# cat foo.rb
execute "load" do
command "/bin/echo 'load called from test::foo'"
action :nothing
end
file "/tmp/foo" do
action :touch
notifies :run, "execute[load]", :immediately
end
@ohookins
ohookins / gist:4119264
Created November 20, 2012 17:00
S3 bucket walker exception
Exception in thread "RubyThread-61: ./s3_ls.rb:3" java.lang.ArrayIndexOutOfBoundsException: 18
at org.jruby.util.MurmurHash.hash32(MurmurHash.java:33)
at org.jruby.RubyString.strHashCode(RubyString.java:1216)
at org.jruby.RubyString.hashCode(RubyString.java:1206)
at org.jruby.RubyHash.internalGetEntry(RubyHash.java:506)
at org.jruby.RubyHash.op_asetForString(RubyHash.java:910)
at org.jruby.RubyHash.fastASetCheckString19(RubyHash.java:879)
at org.jruby.RubyHash.op_aset19(RubyHash.java:905)
at org.jruby.RubyHash$INVOKER$i$2$0$op_aset19.call(RubyHash$INVOKER$i$2$0$op_aset19.gen)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)