Skip to content

Instantly share code, notes, and snippets.

const colors = require('colors/safe');
// 6-sided dice
var min = 1,
max = 6,
first = roll(min, max),
second = roll(min, max);
console.log("Dice 1:", first);
console.log("Dice 2:", second);
console.log(colors.cyan(colors.bold("Tot: " + (first + second))));
/*!
* @license Open source under BSD 2-clause (http://choosealicense.com/licenses/bsd-2-clause/)
* Copyright (c) 2015, Curtis Bratton
* All rights reserved.
*
* Liquid Fill Gauge v1.1
*/
function liquidFillGaugeDefaultSettings(){
return {
minValue: 0, // The gauge minimum value.
app.get('/get_data', (req, res, next) => {
BMP180.fetch( (err, data) => {
if(err) {
console.error("An error on reading the BMP180 occured!");
console.error(err.cause);
}
if(data.type === 'Temperature')
temp = data.value.toFixed(1);
if(data.type === 'Pressure')
press = (data.value / 100).toFixed(2);
import sys
sys.dont_write_bytecode = True # avoid corruptions
import serial
import time as t
import os.path
import ssl
import RPi.GPIO as gpio
import lcd_driver as lcd
import threading as thr
import pychromecast as pych
const sharp = require('sharp');
const path = require('path');
if(process.argv.length < 3) {
console.log('You must provide an image as a cmd-line argument!');
process.exit(-1);
}
sharp(process.argv[2]).toFile(''+ process.argv[2].slice(0, process.argv[2].indexOf('.'))+'.jpg');
console.log('Done!');