This file contains 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: https://en.wikipedia.org/wiki/Metric_prefix | |
function valueToMagnitude(value, unit, fixedPlaces) { | |
var unitExponents = [ | |
[0,''], | |
[3,'k'], | |
[6,'M'], | |
[9,'G'], | |
[12,'T'], | |
[15,'P'], |
This file contains 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
snap = Snap('#mySVG'); | |
gradient = snap.gradient('l(0, 0, 1, 0)red-orange-yellow-green-blue-indigo-violet'); | |
snap.rect(0,0,200,200).attr({ | |
fill: gradient | |
}); |
This file contains 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/ksh | |
hostname="$1" | |
url_protocol="https://" | |
url_path="/cbace7c0fbe7ffad8af83f61a550dcef/xxxxx_nvwwcsKpsN1qajmbto1_500.jpg" | |
## TODO support CNAMES properly - it throws things off | |
### | |
### IPv4 Health Check |
This file contains 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
package ajmas74.experimental.graphics2d; | |
import java.awt.Image; | |
import java.awt.image.BufferedImage; | |
import java.awt.image.ColorModel; | |
import java.awt.image.DataBuffer; | |
import java.awt.image.DataBufferInt; | |
import java.awt.image.DirectColorModel; | |
import java.awt.image.PixelGrabber; | |
import java.awt.image.Raster; |
This file contains 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
var ipv4Regex = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; | |
function expandIPv6(ipv6ColonNotation) { | |
var pad = "0000" | |
var count = (ipv6ColonNotation.match(/:/g)|| []).length; | |
if (count == 0 || count > 7) { | |
// too few or too many colons | |
return "err"; | |
} | |
This file contains 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); |
This file contains 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 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 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 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; |
OlderNewer