Skip to content

Instantly share code, notes, and snippets.

Avatar

Kenneth Falck kennu

View GitHub Profile
View acars2json.py
#!/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 Aug 29, 2015
Oculus Web GL Examples
View vrrender.js
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 Aug 29, 2015
Oculus WebGL Examples
View vrapi.js
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)) {
View keybase.md

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 Aug 29, 2015
Pebble JavaScript example
View helloworld.c
/* 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 Sep 25, 2020
Testing Express apps with random ports
View mytest.coffee
# 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 Sep 22, 2011
Script for generating a Selenium Test Case to delete old Facebook updates
View fbdel.py
#!/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