Skip to content

Instantly share code, notes, and snippets.

View blixt's full-sized avatar

Blixt blixt

View GitHub Profile
#import "AppDelegate.h"
#import <AVFoundation/AVFoundation.h>
@interface AppDelegate ()
@property (nonatomic) AVAssetWriter *writer;
@property (nonatomic) AVAssetWriterInputPixelBufferAdaptor *adaptor;
@property (nonatomic) dispatch_queue_t q;
@blixt
blixt / middleware.go
Created May 5, 2017 16:36
A couple of middleware http.Handler functions for Go
// A couple of middleware http.Handler functions (scroll down).
// EXAMPLE USAGE:
http.HandleFunc("/", RequestHome)
http.Handle("/s/", Cacher(168*time.Hour, http.StripPrefix("/s/", http.FileServer(http.Dir("static")))))
http.Handle("/favicon.ico", FileWithCache("static/favicon.ico", 168*time.Hour))
if err := http.ListenAndServe(":8080", Logger(http.DefaultServeMux)); err != nil {
log.Fatalf("http.ListenAndServe: %v", err)
@cowboy
cowboy / truthy-eq-good-times.js
Created June 21, 2011 00:49
JavaScript: See what == what!
// This should do a pretty good job of iterating through the following array
// and logging any values that == each other. Beware, this is scary stuff!
// http://benalman.com/news/2010/11/schrecklichwissen-terrible-kno/
var arr = [true, 123, {}, {a:1}, [], [0], [123], "hi", function foo(){},
/re/, Infinity, false, 0, "", null, undefined, NaN];
function pretty(v) {
return /^[os]/.test(typeof v) ? JSON.stringify(v) : String(v);
}
@blixt
blixt / OculusQuest.md
Last active February 12, 2024 14:06
Streaming Oculus Quest wirelessly over WiFi to macOS (on a MacBook)

Streaming an Android-based VR headset to your computer

Setting it up the first time

The first time you have to set it up with a cable. The Oculus Quest has a USB-C port (the one used for charging). Use this to connect to your computer.

Preparing your Oculus Quest

Your Quest needs to be in Developer mode. This is super easy, just open your companion app on your phone and go to Settings and enable Developer

@blixt
blixt / logger_middleware.go
Last active April 2, 2024 18:52
Logger middleware for Go HTTP servers which logs every request with response status code in the Apache format.
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"time"
)