Skip to content

Instantly share code, notes, and snippets.

View bkw's full-sized avatar

Bernhard Weisshuhn (a.k.a. bernhorst) bkw

View GitHub Profile
@bkw
bkw / amqpqueue_get_headers.out
Created April 15, 2013 21:29
output of test/amqpqueue_get_headers.phpt with php debug build
body
array(2) {
["first"]=>
string(3) "one"
["second"]=>
int(2)
}
text/plain
one
2
@bkw
bkw / npm-publish.md
Created March 22, 2013 11:05
npm deployment cheatsheet (personal notes, really)

Notes:

  • Don't forget to bump the version in package.json
  • Make extra certain package.json is valid json
  • tag (and push --tags) first.
  • Don't publish your working checkout, it's probably polluted by temporary/private files.

Workflow:

  • update History.md
try {
this['Module'] = Module;
} catch(e) {
this['Module'] = Module = {};
}
var ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function';
var ENVIRONMENT_IS_WEB = typeof window === 'object';
var ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
if (ENVIRONMENT_IS_NODE) {
@bkw
bkw / avc-codec-orig.js
Created February 10, 2013 12:59
Difference between emscriptened Broadway.js h264 decoder. avc-codev-orig.js has all functions relooped except _DetermineNc. It works. avc-codec-relopped has ALL functions relooped and gives wrong results. reloop.diff is the delta between the two.
try {
this['Module'] = Module;
} catch(e) {
this['Module'] = Module = {};
}
var ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function';
var ENVIRONMENT_IS_WEB = typeof window === 'object';
var ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
if (ENVIRONMENT_IS_NODE) {
@bkw
bkw / macports-nodejs-couchdb.md
Created January 27, 2013 16:28
Unsuck Macports CouchDB With Node.JS

Unsucking Macports CouchDB with node.js

Why?

The macports couchdb port has problems. The hip thing to do would probably be switching over to homebrew, but I dislike brew for a couple of reasons, which are beyond the scope of this writeup. Also, building from source failed for me with some strange problem in the makefile, that I'll hunt down later.

So, what's wrong with it?

  • couchdb's javascript viewserver couchjs links against libjs.dylib, which is supplied by the spidermonkey port. That port is ancient, but cannot be easily upgraded because of, well... mongodb. That means: no ES5-goodness for the rest of us. :-(
@bkw
bkw / couchjs.log
Created January 27, 2013 13:10
couchjs.log from npm registry view for iriscouch/couchjs#1
This file has been truncated, but you can view the full file.
couchjs 20449: /opt/local/share/couchdb/server/main.js
Call main
STDIN: ["reset",{"reduce_limit":true,"timeout":50000}]
STDOUT: true
STDIN: ["add_fun","function (doc) {\n\n if (!doc || !doc.versions || !doc[\"dist-tags\"]) return\n if (doc._id.match(/^npm-test-.+$/) &&\n doc.maintainers &&\n doc.maintainers[0].name === 'isaacs')\n return\n var v = doc[\"dist-tags\"].latest\n //Object.keys(doc.versions).forEach(function (v) {\n var d = doc.versions[v]\n if (!d) return\n if (!d.scripts) return\n var inst = d.scripts.install\n || d.scripts.preinstall\n || d.scripts.postinstall\n if (!inst) return\n //emit(d.name + \"@\" + d.version, d.dist.bin || {})\n emit(d._id, d.dist.bin || {})\n //})\n }"]
STDOUT: true
STDIN: ["add_fun","function (doc) {\n if (!doc || !doc._attachments) return\n var orphans = []\n , size = 0\n for (var i in doc._attachments) {\n var n = i.substr(doc._id.length + 1).replace(/
@bkw
bkw / notes.md
Last active December 10, 2015 09:49
Notes on a new way of handling config commands with node-ar-drone

Why is a new way of dealing with client.config() needed?

  • Currently we disregard the acknowledgements the drone sends us. The api on the drone is poorly designed, but it exists. The reason we don't use it is that we would have to cross boundaries between control and navdata. Ugly, but no way around it.

  • Right now, all at-commands are treated equally - they are pushed into an array, and when flush() is called by the interval vom Client.js, a udp packet of all outstanding at-commands is assembled and sent to the drone. But config commands need special handling:

  • Certain configuration options are only available when using the "multiconfig" option. That is: declare a session, profile and application-id upfront and send it prior to every config command within the same UDP packet (config options custom:application_id, profile_id, session_id)

@bkw
bkw / parrot ar.drone mp4 howto.md
Last active September 18, 2018 13:01
How to record a mp4 stream from nodecopter.

Record a stream from the drone as mp4

TL;DR

nc 192.168.1.1 5555 | ./pave2stdout.js | ffmpeg -i - stream.m4v

Details

mp4 is really a terrible choice for streams, because vital information about the video is scattered all over the file. For that reason ffmpeg requires an explicit outputfile (stdout will not work)

@bkw
bkw / svn-remove-stale-branches.sh
Created December 3, 2012 10:05 — forked from estahn/svn-remove-stale-branches.sh
Remove branches that belong to closed tickets
#!/usr/bin/env bash
set -eu
# Base Repository URL
SVN_URL=http://svn-repo-url
# Atlassian Jira URL
JIRA_URL=https://jira-url
@bkw
bkw / build.log
Created November 12, 2012 10:08
rabbitmq-c debian control file librabbitmq0
% dpkg-buildpackage -us -uc
dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security
dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): -D_FORTIFY_SOURCE=2
dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security
dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): -Wl,-Bsymbolic-functions -Wl,-z,relro
dpkg-buildpackage: source package librabbitmq0
dpkg-buildpackage: source version 0.2.0-1ubuntu1
dpkg-buildpackage: source changed by David Gillies <[email protected]>