This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This works by converting text to decomposed unicode form, such that the | |
accents are treated as separate characters. We then select the characters | |
we want, by means of a regex and then join the matched groups. | |
There are certain characters that won't work with this, such as 'ø', since | |
it is not an 'o' with a slash accent. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Script to control the applicaion start and stop | |
## Note, if the application was started separate to this script, | |
## then there is a risk that it will be started twice. | |
## Also note if you plan to use this with systemd, then you need to ensure | |
## the 'Service' section looks as follows: | |
## [Service] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## script for turning and off the connected screen | |
## taken from https://www.raspberrypi.org/forums/viewtopic.php?t=7570 | |
if [ $1 = 'on' ]; then | |
tvservice -p | |
fbset -depth 8 | |
fbset -depth 16 | |
fbset -depth 32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adds all numbers from 1 to maxInteger, inclusive | |
*/ | |
function addAll (maxInteger) { | |
let n = maxInteger; | |
let m = 0; | |
if (n%2 === 1) { | |
m = n; | |
n = n - 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ref: http://stackoverflow.com/questions/1068834/object-comparison-in-javascript | |
function anyOfInArray (array1, array2, findIndexComparator) { | |
var i=0; | |
var containsAny= false; | |
findIndexComparator = function (currentValue, index, arr) { | |
return JSON.stringify(currentValue) === JSON.stringify(this) | |
//return currentValue === this; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This version work on simply checking something that fails a rule, though | |
// it may be useful to check based on estimated password strength. For this | |
// each function would return a value indicating strength. This value could | |
// be positive or negative. For example, a string longer than 16 characters | |
// could get a rating of +5, but being digit only get a -5. Other methods | |
// could simply return 0/+1. | |
var ruleFunctions = { | |
duplicateChars: function(password, min) { | |
var prevChar, i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates an HTTP server to allow to read the sensor data via | |
* HTTP. Improvements could include caching the data, to avoid | |
* the sensor being hit too frequently. | |
* | |
* Not tested in-situ. | |
*/ | |
const express = require('express'); | |
const app = express(); | |
const net = require('net'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs-extra'); | |
const google = require('googleapis'); | |
const OAuth2 = google.auth.OAuth2; | |
const key = require('./key.json'); | |
var baseFolder = 'base'; | |
function downloadFile(file, path) { | |
setTimeout(function () { | |
var filePath = path.concat(file.name).join('/'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// depends on turf and having a copy of the countries.gejson file for the value of the countryOutlines | |
// see: https://github.com/johan/world.geo.json as one source | |
findCountryName (latlon) { | |
var features, i, j, poly; | |
var point1 = turf.point([latlon[1], latlon[0]]); | |
if (this.countryOutlines) { | |
features = this.countryOutlines.features; | |
for (i=0; i<features.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CoordinateParser = { | |
convertDegMinSecToDecDeg: function (deg, min, sec, direction) { | |
var value; | |
if (min === undefined) { min = 0; } | |
if (sec === undefined) { sec = 0; } | |
deg = parseFloat(deg); | |
min = parseFloat(min); |