Skip to content

Instantly share code, notes, and snippets.

View suhajdab's full-sized avatar

Balázs Suhajda suhajdab

View GitHub Profile
#include <Adafruit_NeoPixel.h>
#define PIN 2
#define Pixels 24
#define BG 1
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
@suhajdab
suhajdab / getCircadianValues.js
Last active August 26, 2022 22:22
Calculate Color Temperature and Brightness for current time in HomeyScript
/**
* Adjust Color temperature and Brightness based on time of day
* as if it were April 16th, a nice long spring day in southern Sweden
*/
const VARIABLE_PREFIX = 'CircadianRhythm_';
const MIN_BRIGHTNESS = 0.12;
const MAX_BRIGHTNESS = 1;
const sys = await Homey.system.getInfo();
@suhajdab
suhajdab / rfid-node.ino
Last active March 27, 2022 16:21
Particle Photon + RC522 RFID implant reader
#include "MFRC522/MFRC522.h"
/*
Function Core Pin MRFC522 Pin
Reset D2 RST
SPI SS D1 SDA
SPI MOSI A5 MOSI
SPI MISO A4 MISO
SPI SCK A3 SCK
*/
#include <Adafruit_NeoPixel.h>
#define PIN 2
#define Pixels 25
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#include <Adafruit_NeoPixel.h>
// Pin used on Arduino board
#define PIN 2
// Number of NeoPixels
#define PIXELS 24
// Number of pixels on either side continuously orange to indicate side of vehicle
#define FIXEDPIXELS 1
// Parameter 1 = number of pixels in strip
@suhajdab
suhajdab / global.code-snippets
Last active June 3, 2020 10:51
Easily searchable, filterable, custom console.log snippet for Visual Studio Code
{
"Custom console.log": {
"scope": "javascript,typescript",
"prefix": "basu",
"body": [
"console.log(",
"\t'%cbasu $1',",
"\t'font: italic 16px monospaced; color: lime',",
"\t$2",
");"
@suhajdab
suhajdab / prependChild.js
Created April 29, 2012 12:18
prependChild
Node.prototype.prependChild = function(el) {
this.childNodes[1]&&this.insertBefore(el, this.childNodes[1]) || this.appendChild(el);
}​
@suhajdab
suhajdab / PaperSignalsIdeas.md
Last active December 8, 2017 10:15
Collection of Ideas for Paper Signals: A Voice Experiment

A collaborative list of ideas for Google Paper Signals: A Voice Experiment

Paper Signals are build-it-yourself objects that you control with your voice.

More info on Paper Signals

Let's gather a bunch of ideas that families can build over the holidays to geek out a little. :)

To add your idea/project share:

  • project's name
  • short description
@suhajdab
suhajdab / nodejs-unlock
Last active November 21, 2016 00:00
Super simple remote unlock for OSX via NodeJS
var applescript = require('applescript');
var http = require('http');
var script =
'tell application "System Events"\n\
if name of every process contains "ScreenSaverEngine" then \n\
tell application "ScreenSaverEngine"\n\
quit\n\
end tell\n\
delay 0.2\n\
@suhajdab
suhajdab / NIFE_lamp.ino
Last active February 17, 2016 23:43
RFduino controller for power LED used inside a upcycled NIFE lamp
int ledPin = 6;
int btnPin = 2;
int state = 0;
int power = 0;
float diff = 0;
int steps = 30;
int statesArray[4] = {0, 85, 170, 255};