Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
url='http://pgl.yoyo.org/as/serverlist.php?hostformat=nohtml'
ftp -o - "$url" | awk '{printf "local-zone: \"%s.\" static\n", $1}' > /var/unbound/etc/blacklist.conf.new || exit $?
mv /var/unbound/etc/blacklist.conf.new /var/unbound/etc/blacklist.conf
rcctl reload unbound
@rafrombrc
rafrombrc / http_req_stat_filter.lua
Last active August 29, 2015 14:18
Sample Heka SandboxFilter emitting graphite format stats from HTTP request data
require "string"
require "math"
require "table"
require "cjson"
local status_codes = {}
local request_times = {}
local ticker_interval = read_config("ticker_interval") or error("must provide ticker_interval")
local percent_thresh = read_config("percent_threshold") or 90
# Assign identifier and collection to variables for use in final output.
.metadata.identifier as $i |
.metadata.collection as $c |
# Filter out any items that do not have files metadata.
select(.files != null) |
# Get all non-derivative files that have a file size, and slim down the metadata.
.files |
map(
#! /bin/bash
# certificates are valids during 365 days
VALID=365
TMPPASS="test"
while [[ -z "$password" ]]
do
read -s -p "Enter password for the Certificate Authority (CA) key: " password
echo
require "cjson"
local dt = require 'date_time'
-- Generic decoder for JSON logs. This will extract all JSON
-- keys and add them to the `Fields` variable of the created
-- Heka message.
--
-- Example use:
--
-- [NginxJsonLogDecoder]
@slouma2000
slouma2000 / install_ruby_1.9.3
Last active May 14, 2019 20:27
Install Ruby 1.9.3 on CentOS, RedHat using RVM
Step 1: Upgrade Packages
# yum update
# yum groupinstall "Development Tools"
Step 2: Installing Recommended Packages
# yum install gcc-c++ patch readline readline-devel zlib zlib-devel
# yum install libyaml-devel libffi-devel openssl-devel make
# yum install bzip2 autoconf automake libtool bison iconv-devel
Step 3: Install RVM ( Ruby Version Manager )
@debasishg
debasishg / gist:8172796
Last active July 29, 2024 18:23
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
@rep
rep / masscares.py
Created September 24, 2013 13:31
pycares mass resolver, input names on stdin
#!/usr/bin/python
# -*- coding: utf8 -*-
import sys
import os
import time
import select
import socket
import pycares
@rafaelrosafu
rafaelrosafu / instructions.md
Last active December 17, 2015 19:09
Compile and Install Heka on Centos 6.4

More info on http://hekad.readthedocs.org/en/latest/installing.html

Build and test hekad

yum install git gcc patch python-devel
rpm -ihv http://pkgs.repoforge.org/cmake/cmake-2.8.8-1.el6.rfx.x86_64.rpm

git clone git@github.com:mozilla-services/heka-build.git
cd heka-build
@miekg
miekg / x
Created February 6, 2013 09:21
tld-dnssec-check
for tld in $(awk ' { print $1 }' root-zone | egrep '^[a-z0-9-]+\.$' | sort -u); do
echo -n $tld:
if dig +dnssec DNSKEY $tld | grep -q RRSIG; then
echo -n DNSSEC:
else
echo -n dnssec:
fi
echo $(dig +noall +answer ${tld}cc.jpmens.net txt | awk ' { print $5" "$6" "$7" "$