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 / 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');
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');
CoreMeetme.DataSource = SC.DataSource.extend({
// we assume there is a connection already before we are asked to retrieve anything
fetch: function (store, query) {
// queries are either allDocs calls or views
// queries carry the database name on which they should be executed
var db = query.get('database');
if (!db && query.get('isRemote')) throw new Error("CoreMeetme: no database on query???");
if (!db && query.get('isLocal')) return true; //don't handle local queries
@mauritslamers
mauritslamers / overview_controller.js
Created July 13, 2017 19:11
How to use sproutcore-table
MyApp.overviewController = SC.ArrayController.create(SC.TableDelegate, {
});