This file contains hidden or 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; |
This file contains hidden or 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
#!/bin/bash | |
# apt-get install python-pip | |
# pip install elasticsearch-curator | |
RETAINDAYS=14 | |
INDICES=( suricata apache cee syslog samba logstash ) | |
for i in "${INDICES[@]}" | |
do | |
echo "${i}" |
This file contains hidden or 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
for indice in `pcregrep --color -o1 '^\S+\s+\S+\s+(\S+)' indices.txt `; do | |
curl -ss -XPUT localhost:9200/$indice/_settings -d ' | |
{ | |
"index" : { | |
"number_of_replicas" : 0 | |
} | |
}' | |
done |
This file contains hidden or 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
curl -ssk -XPUT localhost:9200/_cluster/settings -d '{ | |
"transient" :{ | |
"cluster.routing.allocation.exclude._name" : "node-8-es-01,node-9-es-01" | |
} | |
}' |
This file contains hidden or 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
#!/usr/bin/python | |
# A testing implementation of binary trees | |
# Very primitive (key = value, no duplicates, only integers) | |
# http://www.algolist.net/Data_structures/Binary_search_tree/Insertion | |
# http://stackoverflow.com/questions/2598437/how-to-implement-a-binary-tree-in- | |
class Node: | |
def __init__(self, val): | |
self.l = None | |
self.r = None |
This file contains hidden or 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
#!/usr/bin/env python | |
import sys | |
def openfile(argv): | |
with open(argv, 'r') as file: | |
lines = [line.rstrip('\n') for line in file] | |
return lines | |
PUPPET_TPL = """auditd::rule { "audit-rule-%(INDEX)s": |
This file contains hidden or 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
#!/usr/bin/env python | |
# A simple python playground for playing with top-k algorithms | |
# process data stream S and return most frequent K elements | |
# in my case, I create a unix socket and process syslog stream from syslog-ng | |
# syslog template only contains host, program and message; no timestamp | |
# as this is a naive implementation, with native python data structures (dictionaries) | |
# thus only useful for testing, not real data streams | |
import socket | |
import os, os.path |
This file contains hidden or 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
destination d_auditd { | |
file("/var/log/auditd.json" template("$(format-json .auditd.*)\n")); | |
}; | |
parser p_auditd { | |
linux-audit-parser (prefix(".auditd.")); | |
}; | |
filter f_auditd {program("audispd")}; |
This file contains hidden or 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
lvm2: | |
pkg.installed: [] | |
/dev/sdb: | |
lvm.pv_present: | |
- require: | |
- pkg: lvm2 | |
DATA: | |
lvm.vg_present: |
This file contains hidden or 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
[alerta] | |
# Configure Alerta. | |
enabled = true | |
# The Alerta URL. | |
url = "http://192.168.0.197:8080" | |
# Default authentication token. | |
token = "" | |
# Default environment. | |
environment = "Production" | |
# Default origin. |