Skip to content

Instantly share code, notes, and snippets.

View ambud's full-sized avatar

Ambud ambud

View GitHub Profile
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
public class ReusableHashMap<K, V> implements Map<K, V> {
private int size;
private ReusableEntry<K, V>[] entries;
@ambud
ambud / CEFParser.java
Created March 19, 2016 04:46
Java CEF (Common Event Format) Parser
/**
* Copyright 2016 Ambud Sharma
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ambud
ambud / LDAPEngine.java
Created April 7, 2016 07:04
Code snippet to get Kerberos authentication working in your Java app http://theprogrammerway.blogspot.com/2013/05/java-krb5loginmodule-keytab-mystery.html
/** Copyright 2013 Ambud Sharma
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
diff --git a/flume-ng-core/src/main/java/org/apache/flume/source/SyslogSourceConfigurationConstants.java b/flume-ng-core/src/main/java/org/apache/flume/source/SyslogSourceConfigurationConstants.java
index 5a73c88..4b870ef 100644
--- a/flume-ng-core/src/main/java/org/apache/flume/source/SyslogSourceConfigurationConstants.java
+++ b/flume-ng-core/src/main/java/org/apache/flume/source/SyslogSourceConfigurationConstants.java
@@ -56,12 +56,14 @@ public final class SyslogSourceConfigurationConstants {
public static final String DEFAULT_CHARSET = "UTF-8";
public static final String CONFIG_PORT_CHARSET_PREFIX = "charset.port.";
+ public static final String CONFIG_IS_SYSLOG_MULTILINE_BODY = "body.multiline";
@ambud
ambud / Maven Docker Build pom.xml
Created April 21, 2016 17:47
This partial POM configuration for plugin will allow you to build a docker image for your Java application. The build configuration is under a Maven profile and parameterized to only active if the DOCKER_REGISTRY environment variable is set. You are also required to have your docker file under src/main/docker with any other configurations that y…
<profiles>
<profile>
<id>docker</id>
<activation>
<property>
<name>env.DOCKER_REGISTRY</name>
</property>
</activation>
<build>
<plugins>
# Terraform template to have VPC flow logs be sent to AWS Lambda
provider "aws" {
region = "us-east-1"
}
resource "aws_cloudwatch_log_group" "vpc_flow_log_group" {
name = "vpc-flow-log-group"
retention_in_days = 1
}
@ambud
ambud / Bash pretty format json
Created July 22, 2016 20:03
Output pretty JSON in bash
echo '<JSON>' | python -c'import fileinput, json; print(json.dumps(json.loads("".join(fileinput.input())), sort_keys=True, indent=4))'
@ambud
ambud / conditionalbuild.sh
Last active August 22, 2016 21:17
Conditional build
#!/bin/bash -e
# ref: https://raw.githubusercontent.com/cdown/travis-automerge/master/travis-automerge
if [ ! -z "$TRAVIS_TAG" ]; then
printf "Don't execute releases on tag builds request"
exit 0
fi
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
printf "Don't execute releases on pull request"
#!/bin/bash -e
# Ref: https://raw.githubusercontent.com/cdown/travis-automerge/master/travis-automerge
: "${BRANCHES_TO_MERGE_REGEX?}" "${BRANCH_TO_MERGE_INTO?}"
: "${GITHUB_SECRET_TOKEN?}" "${GITHUB_REPO?}"
export GIT_COMMITTER_EMAIL='travis@travis'
export GIT_COMMITTER_NAME='Travis CI'
if ! grep -q "$BRANCHES_TO_MERGE_REGEX" <<< "$TRAVIS_BRANCH"; then
before_script:
# if you are behind a proxy
# - echo "Acquire::http::Proxy \"http://xyz:port\";" >> /etc/apt/apt.conf.d/01-proxy.conf
- apt-get update -qq
- curl -o maven.tgz http://mirror.symnds.com/software/Apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
- tar xf maven.tgz
stages:
- build
- stage
- release