Skip to content

Instantly share code, notes, and snippets.

View postwait's full-sized avatar

Theo Schlossnagle postwait

View GitHub Profile
diff --git a/lptree.c b/lptree.c
index 6973aac..36f301e 100644
--- a/lptree.c
+++ b/lptree.c
@@ -7,6 +7,7 @@
#include <limits.h>
#include <string.h>
#include <stdlib.h>
+#include <pthread.h>
#include <stdio.h>
#include <sys/time.h>
#include <pthread.h>
#include <stdlib.h>
void log_results(const char *name, int nt, double nops, double tdiff) {
printf(" === %s (%d threads, %0.0f total ops) ===\n", name, nt, nops);
printf("\tTotal time: %0.2f ms\n", tdiff*1000);
printf("\tTime per op: %0.1f ns\n", 1000000000.0 * (tdiff/nops));
printf("\tOps per sec: %0.0f ops\n", nops/tdiff);
diff --git a/src/modules-lua/noit/module/resmon.lua b/src/modules-lua/noit/module/resmon.lua
index d23388f..9eb5e5a 100644
--- a/src/modules-lua/noit/module/resmon.lua
+++ b/src/modules-lua/noit/module/resmon.lua
@@ -325,9 +325,9 @@ function initiate(module, check)
-- this is handled later as we need our challenge.
client = HttpClient:new(callbacks)
- rv, err = client:connect(reverse_str, port, use_ssl)
+ rv, err = client:connect(reverse_str, port, use_ssl, headers.Host)
@postwait
postwait / sparkpost.coffee
Created October 4, 2016 13:28
sparkpost.coffee (for hubot)
# Description:
# interacts with the Sparkpost reporting API.
#
# Dependencies:
# None
#
# Configuration:
# HUBOT_SPARKPOST_API_TOKEN your API token with reporting privileges
# HUBOT_SPARKPOST_TIMEZONE the timezone (default America/New_York)
#
bool
BindingInstance::construct()
{
ink_release_assert(this->lua == nullptr);
if ((this->lua = luaL_newstate())) {
luaL_openlibs(this->lua);
// Push a pointer to ourself into the well-known registry key.
#!/usr/bin/python
# This program was created as a modification to Brendan Gregg's
# biolatency script.
from __future__ import print_function
from bcc import BPF
from time import sleep, strftime
import argparse
# arguments
examples = """examples:
# Description:
# interacts with the Sparkpost reporting API.
#
# Dependencies:
# None
#
# Configuration:
# HUBOT_SPARKPOST_API_TOKEN your API token with reporting privileges
# HUBOT_SPARKPOST_TIMEZONE the timezone (default America/New_York)
#
@postwait
postwait / hex.js
Created October 30, 2017 19:35 — forked from valentinkostadinov/hex.js
JavaScript HEX encoding
function toHex(s) {
// utf8 to latin1
var s = unescape(encodeURIComponent(s))
var h = ''
for (var i = 0; i < s.length; i++) {
h += s.charCodeAt(i).toString(16)
}
return h
}
Version: 17.12.0-ce-win46 (15048)
Channel: stable
Sha1: 0ac7325e4f480d6458b9d4ef12b50d8fcf782fae
Started on: 2018/01/09 17:15:42.081
Resources: C:\Program Files\Docker\Docker\Resources
OS: Windows 10 Enterprise Insider Preview
Edition: Professional
Id: 1709
Build: 17063
BuildLabName: 17063.1000.amd64fre.rs_prerelease.171213-1610
#!/bin/bash
SECONDS=5
bail() {
echo "Error: $@"
exit 1
}
DIR=`mktemp -d`
cd $DIR || bail "temp directory failure"