Skip to content

Instantly share code, notes, and snippets.

@lakenen
lakenen / teledraw-canvas-layers.html
Created January 17, 2017 20:29
Teledraw Canvas example with synced layers
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Teledraw Canvas Example</title>
<style type="text/css">
html, body {
background: #888;
}
@lakenen
lakenen / log
Created February 24, 2015 06:14
fontforge segmentation fault
$ fontforge --version
Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
Based on sources from 20:30 GMT 31-Dec-2014-D.
Based on source from git with hash:
fontforge 20:30 GMT 31-Dec-2014
libfontforge 20141231
$ FONTFORGE_LANGUAGE=ff fontforge -c 'Open($1)' 33.pfa
@lakenen
lakenen / config
Created December 11, 2014 22:04
ipv4 to ipv6 ssh proxy
# you probably need to install socat on your proxy host first
Host ipv6_host
User ipv6_user
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
ProxyCommand ssh -q -A ipv4_user@ipv4_proxy socat STDIO TCP:ipv6_host:22
@lakenen
lakenen / keybase.md
Created December 11, 2014 20:47
keybase verification

Keybase proof

I hereby claim:

  • I am lakenen on github.
  • I am lakenen (https://keybase.io/lakenen) on keybase.
  • I have a public key whose fingerprint is 6366 A27F 3C28 D64B 256C 1FE5 02E5 2E20 0562 A91A

To claim this, I am signing this object:

@lakenen
lakenen / example.js
Last active August 29, 2015 14:08
Viewer.js Page Manipulator Plugin
var viewer = Crocodoc.createViewer(myEl, {
url: 'https://view-api.box.com/1/sessions/78983c8bd83b4b03ac719d0f072a7d1d/assets/',
plugins: {
'page-manipulator': {
pages: [
{
page: 1, // re-use (duplicate) page 1
replace: 2, // replace the original page 1
// override whatever links were already on this page
links: [{uri: 'https://static.view-api.box.com/images/spindoge.gif', bbox:[0, 0, 375, 285]}],
@lakenen
lakenen / upload.js
Last active August 29, 2015 14:07
upload multipart file to view api
/*
To run:
Get a Box View API token (https://box-view.readme.io/) and set it to `TOKEN` below.
npm install box-view busboy
node upload.js
navigate to http://localhost:8888 in your browser and submit a file
*/
$ curl https://www.npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6711 100 6711 0 0 3363 0 0:00:01 0:00:01 --:--:-- 3363
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
install npm@latest
fetching: http://registry.npmjs.org/npm/-/npm-2.0.2.tgz
@lakenen
lakenen / xforwarded.py
Last active August 29, 2015 14:06
Django middleware to capture X-Forwarded-Host and X-Forwarded-Port headers
class XForwarded(object):
def process_request(self, request):
try:
request.META['HTTP_HOST'] = request.META['HTTP_X_FORWARDED_HOST']) + ":" + str(request.META['HTTP_X_FORWARDED_PORT'])
except KeyError:
pass
return None
var through = require('through'),
duplex = require('duplexer')
function dosomething() {
var input = through(),
output = through(),
stream = duplex(input, output)
output.write('two')
input.pipe(output)
@lakenen
lakenen / page-offset-data-provider.js
Last active August 29, 2015 14:04
Offset first page in viewer.js LAYOUT_PRESENTATION_TWO_PAGE
Crocodoc.addDataProvider('page-offset', function (scope) {
return {
get: function (type, key) {
var $p, dp = scope.getDataProvider(type);
if (type === 'metadata') {
$p = dp.get(type);
return $p.then(function (data) {
data.numpages += 1;
var page,
exceptions = data.dimensions.exceptions,