Skip to content

Instantly share code, notes, and snippets.

View mauritslamers's full-sized avatar

Maurits Lamers mauritslamers

  • Den Haag, Netherlands
View GitHub Profile
@mauritslamers
mauritslamers / audacity_rescue.js
Created December 5, 2019 21:02
audacity rescue script nodejs with stereo support
// recover from audacity crash
// usage:
// node audacity_rescue.js [sourcedir] [result_file.wav] [mono|stereo]
// the mono or stereo option is optional, the default is mono.
//
// Description:
// This script will sort all files on modification date.
// If you create a backup, make sure you use `cp -a` to preserve the modification date
// or create a zip.
maurits@maurits-iMac:~/Development/gnucash/bindings/nodejs$ ldd build/Release/gnucash.node
linux-vdso.so.1 (0x00007ffe4777c000)
libgncmod-engine.so => /home/maurits/Development/gnucash/bindings/nodejs/build/Release/libgncmod-engine.so (0x00007ff84316f000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff842de6000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff8429f5000)
libgnc-core-utils.so => /home/maurits/Development/gnucash/.build/lib/libgnc-core-utils.so (0x00007ff8427ad000)
libboost_date_time.so.1.65.1 => /usr/lib/x86_64-linux-gnu/libboost_date_time.so.1.65.1 (0x00007ff84259c000)
libboost_regex.so.1.65.1 => /usr/lib/x86_64-linux-gnu/libboost_regex.so.1.65.1 (0x00007ff842294000)
libicui18n.so.60 => /usr/lib/x86_64-linux-gnu/libicui18n.so.60 (0x00007ff841df3000)
libicuuc.so.60 => /usr/lib/x86_64-linux-gnu/libicuuc.so.60 (0x00007ff841a3c000)
@mauritslamers
mauritslamers / getter.c
Created October 23, 2019 15:47
getter for invoice type
GncInvoiceType
gnc_invoice_get_type(InvoiceWindow *iw)
{
/* uses the same approach as gnc_invoice_get_title */
switch (gncOwnerGetType(&iw->owner))
{
case GNC_OWNER_CUSTOMER:
return iw->is_credit_note ? GNC_INVOICE_CUST_CREDIT_NOTE
: GNC_INVOICE_CUST_INVOICE;
break;
@mauritslamers
mauritslamers / nginx_socketcluster.conf
Created September 15, 2016 15:17
socketcluster nginx config
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name server.example.com;
return 301 https://server.example.com$request_uri;
}
@mauritslamers
mauritslamers / server.js
Last active November 25, 2018 20:07
socketcluster running at constant 50% CPU
/*
This is the SocketCluster master controller file.
It is responsible for bootstrapping the SocketCluster master process.
Be careful when modifying the options object below.
If you plan to run SCC on Kubernetes or another orchestrator at some point
in the future, avoid changing the environment variable names below as
each one has a specific meaning within the SC ecosystem.
*/
var path = require('path');
@mauritslamers
mauritslamers / tutorial_jackd2_pine64.md
Last active April 19, 2018 17:06
Howto get JackD running on a Pine64 board

As many people have found, the default jackd version that comes with the Pine64 Ubuntu image (which is version 1.9.10) will crash as soon as you start it with a bus error and a message in the kernel log about an aligment problem.

In later versions of jackd this has been solved, but as there is no package, you're currently required to compile it by hand. This is not as difficult as it might sound, but it requires some tinkering in the terminal. Also: make sure that your pine64 board has enough power. If you use a 2.0A rated power supply, the board might crash in the middle of the process (as has happened to me). This tutorial assumes you are working with either the Ubuntu Basic Image, or the Ubuntu Mate image. If you are running a different image, the same process will apply, but you might need to adjust some actions.

var proxyToelating = function (origReq, origResp, next) {
var url = origReq.url;
var path = require('url').parse(url).pathname;
var proxyReq;
console.log("Trying to proxying " + url);
var me = this;
if (origReq.headers.host) origReq.headers.host = "";
origReq.headers['Authorization'] = "Basic myauth=";
app.use('/webdav', proxy('https://my.domain.ext', {
limit: '1gb',
reqBodyEncoding: null,
parseReqBody: false,
proxyReqOptDecorator: function (proxyReqOpts, srcReq) {
proxyReqOpts.headers['Authorization'] = "Basic myencrypedpasswd";
return proxyReqOpts;
},
}))
@mauritslamers
mauritslamers / test.scm
Created November 4, 2017 17:39
Problem with case
(case "|." ;(assoc-ref evt 'whichBar)
( ("|") (assoc-ref brailleMusicSymbols 'normal-bar-line))
( ("|.") (assoc-ref brailleMusicSymbols 'double-bar-end))
( ("||") (assoc-ref brailleMusicSymbols 'double-bar))
( ("!") (assoc-ref brailleMusicSymbols 'dotted-bar-line))
)
@mauritslamers
mauritslamers / socketcluster_index.js
Last active October 8, 2017 09:46
Changes to socketcluster to accomodate loading the worker as ES6 module
// One change: expose SCWorker by adding the following line as last line
module.exports.SCWorker = require('./lib/scworker');