Skip to content

Instantly share code, notes, and snippets.

@draco2003
draco2003 / neltest.sh
Created March 12, 2019 20:01
NEL Report Tester
#!/usr/bin/env bash
if [ $# -lt 2 ]
then
echo "Usage: neltest.sh report_to test"
echo ""
echo "report_to: is the host to send the error report to"
echo ""
echo "test: 1 | 2 | 3"
echo " 1: single NEL report test"
diff --git a/src/analyzer/alerters.py b/src/analyzer/alerters.py
index edf076b..04f4209 100644
--- a/src/analyzer/alerters.py
+++ b/src/analyzer/alerters.py
@@ -39,7 +39,7 @@ def alert_smtp(alert, metric):
msg['Subject'] = '[skyline alert] ' + metric[1]
msg['From'] = sender
msg['To'] = recipient
- link = '%s/render/?width=588&height=308&target=%s' % (settings.GRAPHITE_HOST, metric[1])
+ link = settings.GRAPH_URL % (metric[1])
var fs = require('fs'),
path = require('path');
function NginxParseTreeNode(name, value, parent, children) {
this.name = name || '';
this.value = value || '';
this.parent = parent || null;
this.children = children || [];
this.comments = [];
}
@draco2003
draco2003 / index.js
Last active December 26, 2015 06:58
Simple example express app that posts input field as empty string
var express = require('express')
, app = express();
app.use(express.bodyParser())
.get('/', function(req, res){
res.send('<form action="/" method="POST"><input type="text" name="test"><input type="submit" value="Submit"></form>');
})
.post('/', function(req, res){
res.send(req.body);
}).listen(3003);
@draco2003
draco2003 / gist:7007503
Created October 16, 2013 13:12
skyline analyzer errors
Sample logs at fresh startup/empty redis (horizon is started first a few seconds before analyzer in this case):
---------------------------------------------------------------------
started with pid 18445
2013-10-16 08:58:16 :: 18445 :: starting skyline analyzer
2013-10-16 08:58:16 :: 18445 :: seconds to run :: 0.35
2013-10-16 08:58:16 :: 18445 :: total metrics :: 40249
2013-10-16 08:58:16 :: 18445 :: total analyzed :: -1
2013-10-16 08:58:16 :: 18445 :: total anomalies :: 0
2013-10-16 08:58:16 :: 18445 :: exception stats :: {'Incomplete': 40250}
2013-10-16 08:58:16 :: 18445 :: anomaly breakdown :: {}
@draco2003
draco2003 / kibana.diff
Created October 7, 2013 14:17
Add a configuration setting to add an Elasticsearch Query Timeout.
diff --git a/KibanaConfig.rb b/KibanaConfig.rb
index 93ebdcc..ed33a83 100644
--- a/KibanaConfig.rb
+++ b/KibanaConfig.rb
@@ -12,6 +12,11 @@ module KibanaConfig
#Set the Net::HTTP read/open timeouts for the connection to the ES backend
ElasticsearchTimeout = 500
+ # A search timeout, bounding the search request to be executed within the
+ # specified time value and bail with the hits accumulated up to that point
diff php-example.php php-example1.php
93,94d92
< static $fp = null;
<
117c115
< if (! $fp) { $fp = fsockopen("udp://$host", $port, $errno, $errstr);}
---
> $fp = fsockopen("udp://$host", $port, $errno, $errstr);
121a120
> fclose($fp);
@draco2003
draco2003 / gist:3903315
Created October 17, 2012 02:05
non-blocking function call
backendEvents.once('process_metrics', function (){
pm.process_metrics(metrics_hash, flushInterval, time_stamp, function emitFlush() {
// Flush metrics to each backend.
backendEvents.emit('flush', time_stamp, metrics_hash);
});
});
backendEvents.emit('process_metrics', time_stamp, metrics_hash);
@draco2003
draco2003 / processor_debug_fix.diff
Created February 9, 2012 05:02
Beta/debugging Processor
diff --git a/plugins/email_plugin.php b/plugins/email_plugin.php
index 98b12b5..f51807b 100644
--- a/plugins/email_plugin.php
+++ b/plugins/email_plugin.php
@@ -43,14 +43,14 @@ function email_plugin_send_methods(){
}
//email plugin
-function email_plugin_notify($check,$check_result,$subscription,$alt_email=false) {
+function email_plugin_notify($check,$check_result,$subscription,$alt_email=false,$data='') {
@draco2003
draco2003 / gist:911298
Created April 9, 2011 10:39
freebsd+veewee demo patch
diff -u definition.rb.orig definition.rb
--- definition.rb.orig 2011-03-15 21:44:28.607976997 -0400
+++ definition.rb 2011-04-09 06:25:10.209508002 -0400
@@ -8,15 +8,15 @@
:cpu_count => '1', :memory_size=> '768',
:disk_size => '10140', :disk_format => 'VDI',:disk_size => '10240' ,
:os_type_id => 'FreeBSD',
- :iso_file => "PCBSD8.2-x86-DVD.iso",
- :iso_src => "ftp://mirrors.isc.org/pub/pcbsd/8.2/i386/PCBSD8.2-x86-DVD.iso",
- :iso_md5 => "6433a8abf6073b177750d48398bed341",