Skip to content

Instantly share code, notes, and snippets.

@bbejeck
bbejeck / tmux-kafka.sh
Created Dec 11, 2015
A script for using tmux with kafka
View tmux-kafka.sh
#!/bin/sh
KAFKA_DIR=/usr/local/kafka_2.11-0.9.0.0-SNAPSHOT
START_ZK="./bin/zookeeper-server-start.sh"
ZK_PROPS="config/zookeeper.properties"
START_KAFKA="./bin/kafka-server-start.sh"
KAFKA_PROPS="config/server.properties"
@bbejeck
bbejeck / CombineByKey.scala
Created Aug 7, 2015
Source code for CombineByKey blog post
View CombineByKey.scala
package bbejeck.grouping
import org.apache.log4j.{Level, Logger}
import org.apache.spark.{SparkConf, SparkContext}
import scala.collection.mutable
/**
* Created by bbejeck on 8/6/15.
* Example usage of combineByKey
@bbejeck
bbejeck / AggregateByKey.scala
Created Jul 31, 2015
Sample code for the Spark PairRDDFunctions - AggregateByKey
View AggregateByKey.scala
package bbejeck.grouping
import org.apache.log4j.{Level, Logger}
import org.apache.spark.{SparkConf, SparkContext}
import scala.collection.mutable
/**
* Created by bbejeck on 7/31/15.
*
@bbejeck
bbejeck / PartiallyAppliedFunctionsTest.java
Created Jul 17, 2015
Source code from "Partially Applied Functions in Java" post.
View PartiallyAppliedFunctionsTest.java
package bbejeck.function;
import org.junit.Test;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
@bbejeck
bbejeck / ThrowingFunction.java
Created Mar 13, 2015
Simple approach to being able to use the Function interface with checked Exceptions.
View ThrowingFunction.java
/*
* *
*
*
* Copyright 2015 Bill Bejeck
*
* 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
*
@bbejeck
bbejeck / LambdaGuavaTest.java
Created Dec 23, 2011
Source for Guava Functions and Java 8 Lambdas
View LambdaGuavaTest.java
import bbejeck.guava.futures.SearchingTestBase;
import bbejeck.support.model.Person;
import com.google.common.base.Function;
import com.google.common.util.concurrent.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.lang.SuppressWarnings;
import java.util.List;
@bbejeck
bbejeck / backup_config.sh
Created Dec 7, 2011
Source for Simple WordPress backups Blog
View backup_config.sh
#! /bin/sh
BLOG=blog_backup
BASE_DIR=/home/<username>/webapps/wp
USER=remote_username
PASS=database_password
DBUSER=database_user
DATABASE=database_name
DEST_DIR=destination_dir
IP_ADDRESS=blog_ip_address
@bbejeck
bbejeck / ListenableFuturesTest.java
Created Nov 23, 2011
Unit test/sample code for ListneableFutures blog
View ListenableFuturesTest.java
import com.google.common.util.concurrent.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
@bbejeck
bbejeck / MonitorExample.java
Created Nov 16, 2011
Sample Code for Guava Monitor Blog
View MonitorExample.java
import com.google.common.util.concurrent.Monitor;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Created by IntelliJ IDEA.
* User: bbejeck
* Date: 11/11/11
* Time: 10:01 PM
*/
You can’t perform that action at this time.