Skip to content

Instantly share code, notes, and snippets.

Avatar

Henri Bergius bergie

View GitHub Profile
@bergie
bergie / get_events.py
Created Mar 3, 2020
Get click/doubleclick from Bluetooth shutter button
View get_events.py
import asyncio
import threading
from evdev import InputDevice, categorize, ecodes
dev = InputDevice('/dev/input/event1')
clicks = 0
timer = None
def count_clicks():
global clicks, timer
@bergie
bergie / unused.js
Created Mar 27, 2018
Find unused components and modules in a FBP project
View unused.js
const fbpManifest = require('fbp-manifest');
const fbpGraph = require('fbp-graph');
const path = require('path');
const showError = (err) => {
console.error(err);
process.exit(1);
};
const baseDir = process.cwd();
@bergie
bergie / FlowhubStats.js
Last active Feb 23, 2018
NoFlo asComponent
View FlowhubStats.js
const noflo = require('noflo');
function getFlowhubStats() {
return fetch('https://api.flowhub.io/stats')
.then((result) => result.json());
}
exports.getComponent = () => noflo.asComponent(getFlowhubStats);
View Bsync.coffee
noflo = require 'noflo'
window.bsyncs = []
class Bsync
constructor: (@request,@waitfor,@block,@callback) ->
exports.getComponent = ->
c = new noflo.Component
c.description = 'bsync'
@bergie
bergie / noflo.json
Created Oct 24, 2017 — forked from forresto/noflo.json
Delaunay masks
View noflo.json
{
"properties": {
"name": "face",
"environment": {
"type": "noflo-browser",
"content": "<video id=\"vid\" width=\"640\" height=\"480\" style=\"position:absolute; top:0px; left:0px\" autoplay></video>\n<canvas id=\"can\" width=\"640\" height=\"480\" style=\"position:absolute; top:0px; left:0px\"></canvas>\n<div id=\"start\" style=\"position:absolute; top:0px; left:0px;\"><button id=\"start\">start camera</button><br/>\ncolor start <input id=\"colorstart\" type=\"range\" min=\"0\" max=\"360\" value=\"0\"></input><br/>\ncolor end<input id=\"colorend\" type=\"range\" min=\"0\" max=\"360\" value=\"360\"></input><br />\ncolor count<input id=\"colorcount\" type=\"range\" min=\"1\" max=\"100\" value=\"50\"></input><br/>\n"
}
},
"inports": {},
"outports": {},
@bergie
bergie / noflo.json
Last active Oct 1, 2020 — forked from forresto/noflo.json
Webcam to palette
View noflo.json
{
"caseSensitive": false,
"properties": {
"name": "main",
"environment": {
"type": "noflo-browser",
"content": "<video id=\"video\" autoplay loop style=\"max-width:100%;\"></video><br>\n<canvas id=\"colors\" width=\"640\" height=\"100\" style=\"max-width:100%;\"></canvas>\n<button id=\"start\">start camera</button>\n<p id=\"message\"></p>"
},
"icon": "cog"
},
@bergie
bergie / noflo.json
Last active Aug 18, 2018
Draggable demo
View noflo.json
{
"caseSensitive": false,
"properties": {
"name": "Movable image",
"environment": {
"type": "noflo-browser",
"content": "<style>\n.area {\n width: 100%;\n height: 300px;\n user-select: none;\n}\n.draggable {\n -moz-user-select: none;\n -khtml-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n -khtml-user-drag: element;\n -webkit-user-drag: element;\n cursor: -webkit-grab;\n cursor: -moz-grab;\n cursor: grab;\n width: 40px;\n height: 40px;\n border-radius: 20px;\n background-color:hsl(220,20%,20%);\n box-shadow: \n 0 -1px 0px hsl(220,100%,100%),\n 0 1px 1px hsla(220,20%,0%,.2),\n 0 3px 8px hsla(220,20%,0%,.1);\n}\n.draggable:active {\n cursor: -webkit-grabbing;\n cursor: -moz-grabbing;\n cursor: grabbing;\n}\n</style>\n\n<div class=\"area\">\n <img class=\"draggable\" src=\"https://meemoo.org/hack-our-apps/shots/recursive.png\" draggable=\"true\">\n</div>"
},
"icon": ""
},
@bergie
bergie / noflo.json
Created Oct 23, 2017
React ToDo Example
View noflo.json
{
"caseSensitive": false,
"properties": {
"name": "ReactTodoExample",
"environment": {
"type": "noflo-browser"
}
},
"inports": {},
"outports": {},
@bergie
bergie / noflo.json
Last active Oct 23, 2017 — forked from forresto/noflo.json
NoFlo clock example
View noflo.json
{
"properties": {
"environment": {
"type": "noflo-browser",
"content": "<div class='area' title='.area'>\n <img id='clock' src='https://i.imgur.com/0S7R8OU.png' style='position:absolute; width:300px; height:300px; top:0; left:0;' />\n <img id='hours' src='https://i.imgur.com/Fw8L3L1.png' style='position:absolute; top:50px; left:130px; height:200px;' />\n <img id='minutes' src='https://i.imgur.com/WtSz99Q.png' style='position:absolute; top:0; left:140px; height:300px;' />\n <img id='seconds' src='https://i.imgur.com/m2PQs6E.png' style='position:absolute; top:0; left:145px; height:300px;' />\n</div>"
},
"name": "Clock"
},
"exports": [],
"processes": {
@bergie
bergie / noflo.json
Last active Oct 23, 2017 — forked from automata/noflo.json
Canvas pattern
View noflo.json
{
"caseSensitive": false,
"properties": {
"name": "Hello Canvas!",
"environment": {
"type": "noflo-browser",
"content": "<canvas id=\"mycanvas\" width=\"200\" height=\"200\"></canvas>\n<br />\n<button id=\"mybutton\">Generate</button>"
}
},
"inports": {},
You can’t perform that action at this time.