Skip to content

Instantly share code, notes, and snippets.

View ohookins's full-sized avatar
🤔
Thinking

Oliver Hookins ohookins

🤔
Thinking
View GitHub Profile
package main
import "fmt"
type Bar struct {
Name string
}
type Foo struct {
Bar
@ohookins
ohookins / gist:5325240
Created April 6, 2013 07:14
5:07 Fragmented MP4 with 128kbps AAC audio
Container: MPEG-4 (5066018 bytes)
Box: ftyp
Byte Range: 0-27 (28 bytes)
Box: moov
Byte Range: 28-1165 (1138 bytes)
Box: mvhd
Byte Range: 36-143 (108 bytes)
Box: trak
Byte Range: 144-1027 (884 bytes)
@ohookins
ohookins / gist:5325242
Last active December 15, 2015 21:19
5:05 F4F with 128kbps AAC audio, fragmented by Adobe f4fpackager
Container: MPEG-4 (5979600 bytes)
Box: ftyp
Byte Range: 0-27 (28 bytes)
Box: moov
Byte Range: 28-82304 (82277 bytes)
Box: mvhd
Byte Range: 36-155 (120 bytes)
Box: trak
Byte Range: 156-40678 (40523 bytes)
@ohookins
ohookins / gist:5325136
Last active December 15, 2015 21:19
5:05 MP4 with 128kbps AAC audio with MOOV atom shifted to start of file by qt-faststart
Container: MPEG-4 (4937617 bytes)
Box: ftyp
Byte Range: 0-27 (28 bytes)
Box: moov
Byte Range: 28-57993 (57966 bytes)
Box: mvhd
Byte Range: 36-143 (108 bytes)
Box: trak
Byte Range: 144-57895 (57752 bytes)
@ohookins
ohookins / gist:5325134
Last active December 15, 2015 21:19
5:05 MP4 with 128kbps AAC audio with standard end of file MOOV atom
Container: MPEG-4 (4937617 bytes)
Box: ftyp
Byte Range: 0-27 (28 bytes)
Box: free
Byte Range: 28-35 (8 bytes)
Box: mdat
Byte Range: 36-4879650 (4879615 bytes)
@ohookins
ohookins / detect.js
Last active December 15, 2015 02:19
Fingerprints of some common SoundCloud players in order to aid detection of the origin of the player.
var alert_messages = new Array();
// SoundCloud's own SDK wrapping the API
if (window.SC) {
alert_messages.push("SoundCloud Connect SDK (HTTP only)");
}
// HTML5 Widget
var frames = $.find("iframe")
if (frames.length > 0) {
@ohookins
ohookins / index.html
Last active December 15, 2015 02:19
Bootstrap part of a SoundCloud embedded player detector.
To add the detect bookmarklet, drag this to your bookmark bar:
<a href="
javascript:(function () {
var script = document.createElement( 'script' );
script.src = '//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
script.onload=loadBookmarklet;
document.body.appendChild(script);
function loadBookmarklet() {
@ohookins
ohookins / gist:5030871
Last active December 14, 2015 04:49
Finding out user limits in Go
package main
import (
"fmt"
"syscall"
)
func main() {
r := syscall.Rlimit{}
@ohookins
ohookins / mysql_async.rb
Last active December 13, 2015 20:29
Asynchronous queries with mysql2 gem and IO.select
# Set up the three different clients to different hosts, and a starting time
client1 = Mysql2::Client.new()
client2 = Mysql2::Client.new()
client3 = Mysql2::Client.new()
start_time = Time.now()
# Run the first query
query1 = "SELECT SLEEP(5);"
puts "Running Query:\n >> #{query1}\n\n"
client1.query(query1, :async => true)
@ohookins
ohookins / gist:4275490
Created December 13, 2012 10:16
Pulling out the type of error from a JSON unmarshalling in Go...
if reflect.TypeOf(err).String() != "*json.SyntaxError" {
t.Errorf("Badly formed input should have resulted in json.SyntaxError, but didn't.")
return
}