Skip to content

Instantly share code, notes, and snippets.

View HalfdanJ's full-sized avatar
🟣

Jonas Jongejan HalfdanJ

🟣
View GitHub Profile
export default function LowpassFilter(Fc) {
var Q = 0.707;
var K = Math.tan(Math.PI * Fc);
var norm = 1 / (1 + K / Q + K * K);
this.a0 = K * K * norm;
this.a1 = 2 * this.a0;
this.a2 = this.a0;
this.b1 = 2 * (K * K - 1) * norm;
this.b2 = (1 - K / Q + K * K) * norm;
@kylemcdonald
kylemcdonald / gcd.cpp
Last active August 29, 2015 14:07
Grand central dispatch examples courtesy of @HalfdanJ
// group of for loops with waiting
int m, n;
dispatch_group_t group = dispatch_group_create();
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH,0), ^{
// before all parallel m
dispatch_apply(m, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(size_t i) {
// parallel m code with i for index
});
// after all parallel m
});