Skip to content

Instantly share code, notes, and snippets.

@mumrah
mumrah / pom.xml
Last active December 20, 2015 02:49
<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.9.2</artifactId>
<packaging>jar</packaging>
<description>kafka</description>
<version>0.8.0-beta1</version>
<name>kafka</name>
<organization>
@mumrah
mumrah / ivy.xml
Created July 24, 2013 13:25
Temporary workaround for bogus POM in Maven Central for Kafka 0.8 beta
<ivy-module version="2.0">
<info organisation="demo" module="trihug-kafka-demo"/>
<configurations>
<conf name="default"/>
</configurations>
<dependencies>
<dependency org="org.apache.kafka" name="kafka_2.9.2" rev="0.8.0-beta1" conf="default->default"/>
<exclude org="com.sun.jdmk"/>
<exclude org="com.sun.jmx"/>
</dependencies>
@mumrah
mumrah / RegexAutomatonTest.java
Last active July 9, 2017 16:13
Iterative regular expression building with Lucene's RegExp and Automaton
package default;
import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.BasicAutomata;
import org.apache.lucene.util.automaton.RegExp;
public class RegexAutomatonTest {
public void testSSN() {
Automaton full = new RegExp("[0-9]{3}-[0-9]{2}-[0-9]{4}").toAutomaton();
@mumrah
mumrah / ConcurrentCompositeConfigurationFactory.java
Created September 4, 2013 16:43
Example of configuring Archaius through Spring XML. Package names have been removed, so this probably won't work without some modification.
import org.apache.commons.configuration.AbstractConfiguration;
import com.netflix.config.ConcurrentCompositeConfiguration;
import java.util.ArrayList;
import java.util.List;
public class ConcurrentCompositeConfigurationFactory {
List<AbstractConfiguration> configs = new ArrayList<AbstractConfiguration>();
public void setConfigs(List<AbstractConfiguration> configs) {
[warn] Detected both new and deprecated style of plugin configuration.
[warn] Ignoring deprecated project/plugins/ directory (/Users/mumrah/Code/apache/kafka/project/plugins).
[info] Loading project definition from /Users/mumrah/Code/apache/kafka/project
[warn] Multiple resolvers having different access mechanism configured with same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`).
[info] Set current project to Kafka (in build file:/Users/mumrah/Code/apache/kafka/)
[warn] Credentials file /Users/mumrah/.m2/.credentials does not exist
[warn] Credentials file /Users/mumrah/.m2/.credentials does not exist
[warn] Credentials file /Users/mumrah/.m2/.credentials does not exist
[warn] Credentials file /Users/mumrah/.m2/.credentials does not exist
[warn] Credentials file /Users/mumrah/.m2/.credentials does not exist
package foo;
public interface Feature {
public String getName();
}
@mumrah
mumrah / README.md
Last active December 28, 2015 06:19
Personal backup strategy

Goals

Provide onsite and offsite archiving and disaster recovery.

Onsite file sync

Synchronize several laptops and phones using BTSync to a local backup server with large attached storage (a few TB at least). Do this continuously to provide a single local backup.

Onsite snapshot backups

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
char *memory;
void signal_handler(int signo)
{

Keybase proof

I hereby claim:

  • I am mumrah on github.
  • I am mumrah (https://keybase.io/mumrah) on keybase.
  • I have a public key whose fingerprint is 557C E8A2 3280 9E50 77A5 FE17 76D0 486F D3CE E771

To claim this, I am signing this object:

@mumrah
mumrah / gist:10488740
Created April 11, 2014 18:07
Javascript to get temperature, humidity, precipitation, wind, and solr radiation from Weather Underground "history" API
function get_weather_history(year, month, day, query, apikey) {
if(month < 10) {
month = "0" + month;
}
if(day < 10) {
day = "0" + day;
}
var ymd = year + "" + month + "" + day;
var url = "http://api.wunderground.com/api/" + apikey + "/history_" + ymd + "/q/" + query + ".json";