Skip to content

Instantly share code, notes, and snippets.

View arnar's full-sized avatar

Arnar Birgisson arnar

View GitHub Profile
### Keybase proof
I hereby claim:
* I am arnar on github.
* I am arnar (https://keybase.io/arnar) on keybase.
* I have a public key ASArXTnc8HziEJBr-IEs1oLJAATCJos3Z0Yqr1ZDxL8sxQo
To claim this, I am signing this object:
@arnar
arnar / u2f-api.js
Created February 18, 2015 17:41
High-level U2F API for Chrome 41+
// Copyright 2014 Google Inc. All rights reserved
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
/**
* @fileoverview High-level U2F API for Chrome 41+.
*/
% Chapter headers and other customizations (fold)
\newenvironment{pabstract}{{\sc abstract}\hspace{.5em}\small}{}
\usepackage{titlesec}
\titleformat{\section}{\large\bfseries}{\protect\makebox[0pt][r]{\thesection\quad}}{0pt}{}
\titleformat{\subsection}{\bfseries}{\protect\makebox[0pt][r]{\thesubsection\quad}}{0pt}{}
\titlespacing*{\paragraph}{0pt}{.7em}{1em}
\setcounter{chapter}{-1}
@arnar
arnar / cph
Created October 25, 2013 19:23
Things to check out:
Ny Carlsberg Glyptotek - a museum mostly with scupltures, but nice atmosphere
The round tower http://www.rundetaarn.dk/
Nice tower in the center with good views. Has a spiral road fit for a horse carriage
to the top because the king was too lazy to walk.
Nyhavn, Stroget and Kobmagergade, but probably you know these already.
http://www.cph-bike-rental.dk/ Nice bike rental
var spawn = require('child_process').spawn;
var midi = require('midi');
// Set up a new input.
var input = new midi.input();
var sharpnames = ['c', 'cis', 'd', 'dis', 'e', 'f', 'fis', 'g', 'gis', 'a', 'ais', 'b'];
var flatnames = ['c', 'des', 'd', 'es', 'e', 'f', 'ges', 'g', 'as', 'a', 'bes', 'b'];
var notenames = flatnames;
#ifndef _SHELLCODE_H
#define _SHELLCODE_H
static char shellcode[] =
"\xb9\xff\xff\xff\xff"
"\x31\xc0" //sets real user id from effective user id.
"\xb0\x31"
"\xcd\x80"
@arnar
arnar / gist:5627777
Last active December 17, 2015 14:49
arnar@air:/tmp$ cat lennartsurl.json
{"totalPoints":14395,"version":1,"rounds":[["round","lat","lng","gLat","gLng","cLat",[null],"cLng",[null],"points"],[1,53.774101,87.18442600000003,46.07323062540838,4.21875,0,0,1337],[2,-31.704593,137.22421099999997,-26.431228064506424,132.890625,0,0,2296],[3,46.165393,14.310496999999941,47.754097979680026,14.58984375,0,0,2845],[4,22.218447,114.211588,22.375476015564765,114.1534423828125,0,0,5210],[5,-15.780246,-47.92931199999998,-13.923403897723334,-49.21875,0,0,2707]],"isChallenge":false,"challengeScore":null}
arnar@air:/tmp$ for url in $(cat lennartsurl.json \
| jq -r '.rounds[1:][] | @uri "http://maps.googleapis.com/maps/api/geocode/json?latlng=\(.[1]),\(.[2])&sensor=true"'); do \
curl -s $url | jq '.results[0].formatted_address'; \
done
"ulitsa Vodopadnaya, Novokuznetsk, Kemerovo Oblast, Russia, 654000"
"Stuart Highway, Mount Gunson SA 5710, Australia"
@arnar
arnar / gist:5143144
Last active December 14, 2015 20:19
Monitor.registerStub = function (name, fun) {
Monitor.prototype[name] = function () { return fun.apply(this, arguments); }
}
exports.config =
# See docs at http://brunch.readthedocs.org/en/latest/config.html.
modules:
definition: false
wrapper: (path, data) ->
if data.match /^\s*define\s*\(\s*\[/
data.replace(/^(\s*define\s*\()/, "$1#{path}, ")
else
"""
define(#{path}, ['require', 'jquery'], function(require, $) {
@arnar
arnar / gist:3838851
Created October 5, 2012 09:06
pyramid_debugtoolbar and requirejs conflict
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
def main(request):
return Response('''
<html>
<head>
<script src="http://requirejs.org/docs/release/2.1.0/minified/require.js"></script>