Skip to content

Instantly share code, notes, and snippets.

Avatar

Maurits Lamers mauritslamers

  • Den Haag, Netherlands
View GitHub Profile
@mauritslamers
mauritslamers / audacity_rescue.js
Created Dec 5, 2019
audacity rescue script nodejs with stereo support
View audacity_rescue.js
// 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.
View ldd-output_gnucash.node
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 Oct 23, 2019
getter for invoice type
View getter.c
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 Nov 25, 2018
socketcluster running at constant 50% CPU
View server.js
/*
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');
View custom_proxy.js
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=";
View express_app.js
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;
},
}))
View test.scm
(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 Oct 8, 2017
Changes to socketcluster to accomodate loading the worker as ES6 module
View socketcluster_index.js
// One change: expose SCWorker by adding the following line as last line
module.exports.SCWorker = require('./lib/scworker');
View datasource.js
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 Jul 13, 2017
How to use sproutcore-table
View overview_controller.js
MyApp.overviewController = SC.ArrayController.create(SC.TableDelegate, {
});