Skip to content

Instantly share code, notes, and snippets.

@Hexagon
Hexagon / node-telldus-example
Created December 11, 2013 19:44
Simple example for node-telldus
// Initiate telldus-core wrapper
var telldus = require('telldus'),
readline = require('readline');
// Get all device statuses
var devices = telldus.getDevices();
console.log('Device status:', devices);
// Turn on and off Device 1
//telldus.turnOn(0);
@Hexagon
Hexagon / parametric_spacer.scad
Last active September 4, 2022 06:33
Parametric OpenSCAD distance/spacer
// ------------------------------------------------------
// User configurable parameters
// ------------------------------------------------------
spacer_height = 15; // Height in mm
m_standard_size = 4; // M-standard (M1.6 -- M16) is currently supported, 4 = M4, 1.6 = M1.6
undersize_for_threading = true; // True use the appropriate undersize for postprocessing with a tap,
// false makes a pure spacer
hex_shape = true; // True forms a hexagonal spacer(nut), false makes a round outer perimiter
wall_thickness = 3; // Indicates the maximum wall thickness in case of an
- [ ] Todo 1
- [ ] Todo 1.1
- [ ] Todo 1.2
- [ ] Todo 2
@Hexagon
Hexagon / notification.js
Last active August 29, 2015 14:06
Notification module
/*
Usage
// Send an notification
channel.emit('notification:send',{
title: 'Woop',
body: 'Woop woop',
icon: 'gfx/icon.png'
});
/* Usage:
channel.emit('audio:play',message);
channel.emit('audio:on');
channel.emit('audio:off');
*/
// Sounds module, used for emitting those annoying bl-up sounds when receiving a message
define(['queue','mediator'], function (queue,mediator) {
define({
message: [
[261.63*2,0,50],
[261.63*3,0,50],
[261.63*4,50,50],
[261.63*5,50,50]
],
person_joined: [
[261.63*3,0,200],
[261.63*1,0,200],
<?php
$cache_url = 'http://www.yr.no/sted/Sverige/V%C3%A4sternorrland/Johannedal/forecast.xml';
$cache_file = 'cache/weather.dat';
$cache_life = '120'; // Cachetid, sekunder
$period_text = Array('Natt','Förm.','Efterm.','Kväll');// Vädret i<period_text>
$sym_text = Array(
"1" => "Soligt och klart",
"2" => "Lätt molnighet",
"3" => "Delvis molnigt",
// Measure space usage on axises, we need to do this before drawing anything
i = 0;
while ((dataset = this.datasets[i++])) {
axises = [[this.yAxises[dataset.y.axis],1,2],[this.xAxises[dataset.x.axis],3,0]];
for (j = 0; j < axises.length; j++) {
axis = axises[j];
if (!axis[0]._measured) {
temp = parseInt(axis[0].font.split(' ')[0]);
padding[axis[(axis[0].axis % 2) ? 1 : 2]] += margin + (axis[0].scale?axis[0].majorTickHeight:0) + (axis[0].name?temp:0) + (axis[0].labels?temp:0);
axis[0]._measured=true;
<!DOCTYPE html>
<html>
<head>
<title>huset.nu</title>
<meta charset="utf-8">
<link href="home.png" rel="icon" type="image/x-icon">
<!-- Mobile viewport fix -->
var sqlite3 = require('sqlite3'),
config = require('./config.json'),
datasource = require('./datasource.js'),
util = require('util');
module.exports = {
Init: function (callback) {
this.queries = Array();
this.queries['create_log_value_table'] = 'CREATE TABLE %s (id INTEGER PRIMARY KEY, value INT, timestamp DATETIME DEFAULT CURRENT_TIMESTAMP)';
this.queries['create_state_value_table'] = 'CREATE TABLE states (id INTEGER PRIMARY KEY, name TEXT, value INT)';