Skip to content

Instantly share code, notes, and snippets.

@wardbekker
wardbekker / kibana_squid2.json
Last active September 27, 2017 10:42
Sample Squid2 Kibana Dashboard
[
{
"_id": "Squid-Dashboard",
"_type": "dashboard",
"_source": {
"title": "Squid Dashboard",
"hits": 0,
"description": "",
"panelsJSON": "[{\"id\":\"Squid-Destination-Countries\",\"type\":\"visualization\",\"panelIndex\":1,\"size_x\":12,\"size_y\":7,\"col\":1,\"row\":1}]",
"optionsJSON": "{\"darkTheme\":false}",
@wardbekker
wardbekker / profiles.json
Created September 25, 2017 08:53
Apache Metron hands-on profile
{
"profiles": [
{
"profile": "count_unique_dist_addr",
"foreach": "ip_dst_addr",
"init": { "count": 0 },
"update": { "count": "count + 1" },
"result": "count"
}
]
@wardbekker
wardbekker / squid2_index.sh
Created September 25, 2017 08:39
Apache Metron Hands-on Squid2 ES index definition
curl -XPOST localhost:9200/_template/squid2_index -d '
{
"template": "squid2_index*",
"mappings": {
"squid2_doc": {
"_timestamp": {
"enabled": true
},
"properties": {
"timestamp": {
@wardbekker
wardbekker / mindwave_nifi_ingest.md
Last active March 6, 2017 09:27
Mindwave NIFI ingest instructions

Mindwave Neurosky driver installation for OSX Sierra

  1. Download and install the latest driver from http://download.neurosky.com/public/Products/MindWave%20headset/RF%20driver%20for%20Mac/MindWaveDriver5.1.pkg
  2. After the driver is installed, download and install the latest MindWave Manager from http://download.neurosky.com/public/Products/MindWave%20headset/RF%20driver%20for%20Mac/MindWave%20Manager4.0.4.zip
  3. Launch the MindWave Manager, navigate to "Pairing" section and click the "Search for MindWave", then follow the instructions to pair the headset.

Install NIFI on OSX Sierra with Homebrew

  1. Install Homebrew from the terminal: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Install NIFI (time of writing v1.1.2): brew install nifi
@wardbekker
wardbekker / install_maven.sh
Created September 6, 2016 15:50
Install maven install log
[root@sandbox ~]# ./iot-truck-streaming/setup/bin/install_maven.sh
--2016-09-06 15:48:17-- http://apache.cs.utah.edu/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
Resolving apache.cs.utah.edu... 155.98.64.87
Connecting to apache.cs.utah.edu|155.98.64.87|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8491533 (8.1M) [application/x-gzip]
Saving to: “apache-maven-3.3.9-bin.tar.gz”
100%[==================================================================================================================================================================>] 8,491,533 101K/s in 14s
# web cluster nodes
# in this setup we have three local application servers
upstream web-cluster {
server a4.mzstatic.com;
#server 10.0.0.12;
#server 10.0.0.13;
}
# force redirect of http to https
# application will be available only over https
@wardbekker
wardbekker / cloudflare_ips.sh
Created April 21, 2015 09:22
Cloudflare ipv4 iptable rules
for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -s $i -m multiport --dports http,https -j ACCEPT; done
iptables -A INPUT -p tcp --dport http -j DROP
iptables -A INPUT -p tcp --dport https -j DROP
iptables-save > /etc/iptables/rules.v4
@wardbekker
wardbekker / leetcode.erl
Created December 24, 2014 10:16
Finding the Minimum Window in S which Contains All Elements from T
-module(leetcode).
-export([min_window/0]).
%% Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
%% For example,
%% S = "ADOBECODEBANC"
%% T = "ABC"
%% Minimum window is "BANC".
== Rebar.config:
{erlydtl_opts,[{translation_fun, {agigo_util, translate}}]}.
== Error:
DEBUG: Worker compilation failed: {{error,
{'EXIT',
{badarg,
-module(test).
-export([foo/2, bla/0]).
%% here we prepend and append, resulting in a copy
bla() ->
io:format("before: ~p~n", [erlang:process_info(self(),binary)]),
A = foo(<<"1234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345781234578123457812345