Skip to content

Instantly share code, notes, and snippets.

View hillar's full-sized avatar

Hillar hillar

View GitHub Profile
@hillar
hillar / influxdb-udp.mjs
Created January 26, 2022 10:07
influxdb v1.8 udp only client write points
import dgram from 'dgram';
export class InfluxUdp {
constructor(opts = {}) {
this.host = opts.hostname || opts.host || '127.0.0.1';
this.port = opts.port || 8089;
this.family = opts.family || 'udp4'
if (!(this.family === 'udp4' || this.family === 'udp6')) throw new Error('The family of socket must be either udp4 or udp6')
this.client = dgram.createSocket(this.family)
import { manifest } from '@sapper/internal/manifest-server'
export const definition = () => {
const openapi = { openapi: '3.0.0', paths: {} }
const routes = manifest.server_routes
for (const route of routes) {
const pattern = route.pattern.toString()
let name = pattern.replace('^\\/', '').replace('\\/?$/', '')
let params
if (name.endsWith('\\/([^/]+?)')) {
var webeid = function(e) {
"use strict";
var t, s = Object.freeze({
VERSION: "0.0.1",
MSG_DEFAULT_TIMEOUT: 12e4
});
!function(e) {
e.ERR_WEBEID_AUTH_FAIL = "ERR_WEBEID_AUTH_FAIL",
e.ERR_WEBEID_STATUS_FAIL = "ERR_WEBEID_STATUS_FAIL",
e.ERR_WEBEID_MSG_PENDING = "ERR_WEBEID_MSG_PENDING",
@hillar
hillar / transformwithpool.mjs
Last active February 11, 2020 08:18
stream transform with internal pooling
import { Transform } from "stream";
import { inspect } from "util";
import { kStringMaxLength as STRINGMAXLENGTH } from "buffer";
import { InfluxUdp } from "./influxdb-udp.mjs";
export function wait(ms, ...msg) {
ms = Math.round(ms);
return new Promise(resolve => {
//printProgress('pause ',ms, msg)
setTimeout(() => {
@hillar
hillar / Dockerfile.alpine.R
Last active September 10, 2019 21:58
R in ALPINE docker
FROM alpine:3
MAINTAINER "No Maintenance Intended http://unmaintained.tech/"
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV BUILD_DEPS \
libc-dev \
cairo-dev \
@hillar
hillar / nos.js
Created December 5, 2018 13:03
Newly Observed Sessions
/*
NOS === Newly Observed Sessions
depends on https://github.com/simme/node-http-digest-client
*/
'use strict'

Keybase proof

I hereby claim:

  • I am hillar on github.
  • I am hillar (https://keybase.io/hillar) on keybase.
  • I have a public key ASBnMOK18P18W-RRnsdCJH3KaXX-EJUGQz5E2Lvfqkc8Kwo

To claim this, I am signing this object:

@hillar
hillar / parseSuricataInSyslogBotAndSendToXMPP.py
Created February 2, 2017 13:54
read suricata alerts from syslog and send to xmpp MUC
"""
/etc/suricata/suricata.yaml
...
# Extensible Event Format (nicknamed EVE) event log in JSON format
- eve-log:
enabled: yes
filetype: syslog
filename: eve.json
prefix: "@cee: "
@hillar
hillar / kapacitor_udf_skewness.go
Created December 8, 2016 13:53
skewness udf for Kapacitor
package main
import (
"bytes"
"encoding/gob"
"errors"
"log"
"os"
"math"
@hillar
hillar / kapacitor_udf_kurtosis.go
Created December 8, 2016 13:34
kurtosis udf for Kapacitor
package main
import (
"bytes"
"encoding/gob"
"errors"
"log"
"os"
"math"