Skip to content

Instantly share code, notes, and snippets.

View kennu's full-sized avatar

Kenneth Falck kennu

View GitHub Profile
#!/usr/bin/env python
from __future__ import print_function
import json
import re
def acars2json(filename):
messages = []
message = { 'header':'', 'content': ''}
with open(filename) as f:
line = f.readline()
@kennu
kennu / vrrender.js
Last active August 29, 2015 14:06
Oculus Web GL Examples
function render(time) {
// Render next frame
requestAnimationFrame(render);
// Update camera with VR head tracking data
updateVRDevice();
// Render screen in VR mode or in regular 3D mode
if (inFullscreen && displayDevice) {
renderer.enableScissorTest(true);
@kennu
kennu / vrapi.js
Last active August 29, 2015 14:06
Oculus WebGL Examples
if (navigator.getVRDevices) {
var displayDevice, sensorDevice;
navigator.getVRDevices().then(function (devices) {
for (var i = 0; i < devices.length; i++) {
if (!displayDevice && devices[i] instanceof HMDVRDevice) {
displayDevice = devices[i];
}
}
for (var i = 0; i < devices.length; i++) {
if (!sensorDevice && devices[i] instanceof PositionSensorVRDevice && (!displayDevice || devices[i].hardwareUnitId == displayDevice.hardwareUnitId)) {

Keybase proof

I hereby claim:

  • I am kennu on github.
  • I am kennu (https://keybase.io/kennu) on keybase.
  • I have a public key whose fingerprint is 9275 6FAB 0E7E E729 AD5A DE97 C162 C8F2 10C4 652A

To claim this, I am signing this object:

@kennu
kennu / helloworld.c
Last active August 29, 2015 13:57
Pebble JavaScript example
/* Native C code for sending an AppMessage when the Select button is pressed. */
/* The response is shown on the watch screen. */
#include <pebble.h>
static Window *window;
static TextLayer *text_layer, *text_layer2;
static const uint32_t LOCATION_KEY = 123;
static const uint32_t WEATHER_KEY = 124;
@kennu
kennu / mytest.coffee
Last active September 25, 2020 07:48
Testing Express apps with random ports
# CoffeeScript version
http = require 'http'
express = require 'express'
app = express()
server = http.createServer(app).listen()
app.set 'port', server.address().port
app.get '/', (req, res) -> res.send hello:'world'
baseurl = 'http://127.0.0.1:' + app.get('port') + '/'
@kennu
kennu / fbdel.py
Created September 22, 2011 20:50
Script for generating a Selenium Test Case to delete old Facebook updates
#!/usr/bin/env python
# This script generates a Selenium Test Case (.html) which will delete all your old Facebook status updates when run in the browser.
# The MAX_AGE setting specifies the number of days of old status updates to keep.
# Created by Kenneth Falck <kennu@iki.fi> 2011
MAX_AGE = 30
from urllib import urlretrieve
from datetime import datetime, timedelta
import imp