Skip to content

Instantly share code, notes, and snippets.

View liamwhan's full-sized avatar

Liam Whan liamwhan

  • Australia
View GitHub Profile
@dv1
dv1 / sample-rate-conversion-with-polyphase-filtering-example.cpp
Created May 11, 2019 20:19
Simple example for how to perform bandlimited sample rate conversion with a polyphase filter
#include <vector>
#include <string>
#include <cmath>
#include <iostream>
#include <sndfile.h>
#ifdef WITH_RLIMIT
#include <sys/resource.h>
#endif
@liamwhan
liamwhan / NodeDebugWinVS2017Setup.md
Last active November 22, 2022 06:57
How to setup Debugging Node.js C++ Add-on on Windows with Visual Studio 2017

How to setup Debugging Node.js C++ Add-on on Windows with Visual Studio 2017

This is a succinct step-by-step guide to setting up a debugging environment for Node.js C++ Addons.

It is based on this great article which goes into a lot more detail.

1. Build Node.js with Debug symbols enabled

NOTE: You'll need an archive utility that can handle gzip and tar extensions. I used 7-Zip

Just some notes and references for myself.

  • In bash, you can access your C:\ drive via /mnt/c/
  • ~ = C:\Users\MLM\AppData\Local\lxss\home\mlm and is different from your Windows user directory C:\Users\MLM

How to google things

@danharper
danharper / gulpfile.js
Last active April 11, 2024 08:31
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@joecritch
joecritch / gist:1476393
Created December 14, 2011 12:30
Basic auth middleware for Node.js Express
function basic_auth (req, res, next) {
if (req.headers.authorization && req.headers.authorization.search('Basic ') === 0) {
// fetch login and password
if (new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString() == 'usernamehere123:passwordhere123') {
next();
return;
}
}
console.log('Unable to authenticate user');
console.log(req.headers.authorization);
@troufster
troufster / HashMap.js
Created November 22, 2010 19:45
Javascript 2d spatial hash
var HashMap = function(cell_size) {
this.cell_size = cell_size;
this.grid = [];
}
HashMap.prototype._key = function(vec) {
var cellsize = this.cell_size;
return Math.floor(vec.x/cellsize) * cellsize + ' ' +
Math.floor(vec.y/cellsize) * cellsize;
}