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
has_waves <- function(c,try2=FALSE,try3=FALSE){ | |
lc <- length(c)-1 | |
if (lc < 3) { | |
return(NA) | |
} | |
notnas <- diff(which(!is.na(c))) | |
notnas <- notnas[notnas>1] | |
lnotnas <- length(notnas) | |
lunotnas <- length(unique(notnas)) | |
if (lunotnas==1 & 2 < lnotnas & lnotnas < lc){ |
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
<%doc> | |
whois(ish) REST for netdot | |
Fetch contact information for a given IP address | |
if ip not found, then closest covering netblock contacts are returned | |
if direct contacts not found,then parent contacts are returned | |
install == copy this next to other REST scripts | |
(/usr/local/netdot/htdocs/rest/whois) |
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
{ | |
"title": "mlch kbn", | |
"services": { | |
"query": { | |
"idQueue": [ | |
1, | |
2, | |
3, | |
4 | |
], |
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
//wget http://sk.ee/upload/files/JUUR-SK.PEM.cer | |
//wget http://sk.ee/upload/files/EECCRCA.pem.cer | |
//wget http://sk.ee/upload/files/ESTEID-SK%202007.PEM.cer | |
//wget http://sk.ee/upload/files/ESTEID-SK%202011.pem.cer | |
var fs = require('fs'), | |
http = require('http'), | |
https = require('https'), | |
express = require('express'); |
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
passport.use(new SSLClientCertificateStrategy({ca: Config.get('clientCertificateCA'), | |
crl: Config.get('clientCertificateCRL', []), | |
ocsp: Config.get('clientCertificateOCSP',[])}, | |
function(userid, done) { | |
Db.get("users", "user", userid, function(err, suser) { | |
if (err) {return done(err);} | |
if (!suser || !suser.exists) {console.log(userid, "doesn't exist"); return done(null, false);} | |
if (!suser._source.enabled) {console.log(userid, "not enabled"); return done("Not enabled");} | |
suser._source.settings = suser._source.settings || {}; |
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
{ | |
"template": "prefix-*", | |
"mappings": { | |
"_default_": { | |
"_source": { "compress": true }, | |
"dynamic_templates": [ | |
{ | |
"string_template" : { | |
"match" : "*", | |
"mapping": { "type": "string", "index": "not_analyzed" }, |
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
library(httr) | |
library (plyr) | |
set_config(config=structure(list(noproxy = c("127.0.0.1")), .Names = "noproxy", class = "config")); | |
set_config(config=accept_json()); | |
u <- "http://127.0.0.1:9200/_all/_search" | |
# time series by fix period 1d | |
p <- "{\"facets\":{\"histo1\":{\"histogram\":{\"field\":\"yourtimefield\",\"time_interval\":\"1d\"}}},\"size\":0}" | |
r <- content(POST(u,body=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
var async = require('async.js'); | |
var data = {} | |
data.time = 12345678; | |
data.tags = [1,2,3]; | |
function post (data) { | |
var results = {}; | |
results.start = new Date().getTime(); | |
var updateSession = function(callback) { | |
console.log('updateSession') | |
results.saved = true; |
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 LOG_LEVEL = 7; // 7 debug; 6 info; 5 notice; 4 error; | |
var ADMIN = "admin@localhost"; | |
var NodeSyslogLoggerSimple = require('node-syslog-logger-simple'); | |
var logger = new NodeSyslogLoggerSimple({'level':LOG_LEVEL}); | |
logger.debug('logger=ok'); | |
var exec = require('child_process').exec; | |
var EXEC_OPTIONS = { encoding: 'utf8', | |
timeout: 5000, |
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
// see Robert Sedgewick :: Left-leaning Red-Black Trees | |
const RED = true; | |
const BLACK = false; | |
var Node = function(key, value) { | |
this.key = key; | |
this.value = value; | |
this.color = RED; | |
this.N = 1; |
OlderNewer