Skip to content

Instantly share code, notes, and snippets.

View HalfdanJ's full-sized avatar
🟣

Jonas Jongejan HalfdanJ

🟣
View GitHub Profile
@HalfdanJ
HalfdanJ / screenshot-websocket.js
Created October 1, 2019 22:44
A websocket server sending screenshot as base64 encoded blob
// Requires ws and screenshot-desktop
const WebSocket = require('ws');
const screenshot = require('screenshot-desktop')
const wss = new WebSocket.Server({ port: 8889 });
wss.on('connection', function connection(ws) {
ws.on('message', function incoming(message) {
console.log('received: %s', message);
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;
@HalfdanJ
HalfdanJ / addons.make
Last active February 4, 2017 14:03
Small ofApp that forwards the last layer from darknet model to osc to use with Wekinator
ofxDarknet
ofxOpenCv
ofxOsc
@HalfdanJ
HalfdanJ / app.js
Last active January 10, 2017 01:34
Mapzen Vector Tile Downloader
const fs = require('fs');
const request = require('request');
const _ = require('underscore');
// Lat, lng coordinates the export is centered around
// const location = [40.729337, -73.983557]
const location = [40.710591, -73.999032]
// Number of tiles to fetch in x and y direction.
const numTiles = [10, 10];
<!doctype html>
<html>
<head>
<title>Three.js Boilerplate</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r79/three.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/stats.js/r16/Stats.min.js"></script>
@HalfdanJ
HalfdanJ / threejsBoilerplate.html
Last active February 7, 2020 18:18
THREE.JS Boilerplate with controls
<!doctype html>
<html>
<head>
<title>Three.js Boilerplate</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r79/three.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/stats.js/r16/Stats.min.js"></script>
@HalfdanJ
HalfdanJ / ndb-of-stacktrace.sh
Created June 16, 2016 21:14
Run stacktrace of NDB application
adb logcat | $NDK/ndk-stack -sym build/intermediates/binaries/debug/arm7/obj/armeabi-v7a
@HalfdanJ
HalfdanJ / alphafbo.cpp
Created May 25, 2016 19:00
ofFbo with premultiplied alpha
// Kudos to armadilly
fbo.begin();
///pre-multiply background color of the fbo for correct blending!
ofClear(ofColor(fboBgColor * (fboBgColor.a / 255.) , fboBgColor.a));
//Set this blending mode for anything you draw INSIDE the fbo
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
//your draw code here!
fbo.end();