Skip to content

Instantly share code, notes, and snippets.

Exception in thread "iothread-2" java.lang.NullPointerException
at zmq.Utils.tuneTcpSocket(Utils.java:48)
at zmq.TcpListener.acceptEvent(TcpListener.java:91)
at zmq.IOObject.acceptEvent(IOObject.java:123)
at zmq.Poller.run(Poller.java:250)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "iothread-2" java.lang.NullPointerException
at zmq.Utils.tuneTcpSocket(Utils.java:48)
at zmq.TcpListener.acceptEvent(TcpListener.java:91)
at zmq.IOObject.acceptEvent(IOObject.java:123)
@terrancesnyder
terrancesnyder / kafka-consumer.java
Created February 8, 2014 16:12
Simple example of publishing avro messages to Kafka.
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.avro.io.BinaryDecoder;
import org.apache.avro.io.BinaryEncoder;
import org.apache.avro.io.DecoderFactory;
@terrancesnyder
terrancesnyder / CustomJwtTokenStore
Created May 30, 2017 23:22 — forked from maxsap/CustomJwtTokenStore
Spring Security OAuth2 programmatic configuration.
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.jwt.JwtHelper;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2RefreshToken;
import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;
@terrancesnyder
terrancesnyder / network security groups azure.sh
Created October 25, 2016 17:41
network security groups azure.sh
root@dndubuntu1204:/home/azureuser/azure-xplat-cli-azure-dev# node bin/azure network nsg rule set armrestestgrp2n nsg2n nsgrule2n -d 'Allow incoming traffic from proxy22' -p 'Tcp' -f '15.203.169.110/16' -o '*' -e 'VirtualNetwork' -u '7000-7500' -c Allow -r Outbound
info: Executing command network nsg rule set
+ Looking up the network security group "nsg2n"
+ Setting a network security rule "nsgrule2n"
+ Looking up the network security group "nsg2n"
data: Id : /subscriptions/bfb5e0bf-124b-4d0c-9352-7c0a9f4d9948/resourceGroups/armrestestgrp2n/providers/Microsoft.Network/networkSecurityGroups/nsg2n/securityRules/nsgrule2n
data: Name : nsgrule2n
data: Type : Microsoft.Network/networkSecurityGroups/securityRules
data: Provisioning state : Succeeded
data: Description : Allow incoming traffic from proxy22
@terrancesnyder
terrancesnyder / kafka-kill.sh
Last active July 20, 2016 13:38
Kafka 0.8.x Fix
sudo su
echo "Shutting down sync server... try 1"
service kafka-sync stop
sleep 2
echo "Shutting down sync server... try 2"
service kafka-sync stop
sleep 2
echo "Shutting down server... try 1"
service kafka-server stop
sleep 2
@terrancesnyder
terrancesnyder / datemath.md
Last active May 30, 2016 16:50
Date Math

Date Support

The dates used within the platform support more than simple date/time constraints. Almost all dates within the platform are strings and have special semantics when dealing with periodicity as well as general date/math functions that make it much easier to specify effective start/stop period and work within date ranges.

Basic Date Format

The basic date format is defined as YYYY-MM-DDThh:mm:ssZ where:

  • YYYY is the year.
  • MM is the month.
  • DD is the day of the month.
r.db('test').table('templates').getField('variables').concatMap(function(v) {
return v('name')
}).distinct()
@terrancesnyder
terrancesnyder / vagrant_reset_network.sh
Created May 16, 2016 20:44
Reset Vagrant Networking
sudo ifdown --exclude=lo -a && sudo ifup --exclude=lo -a
r.db('test').table('templates').filter({ network: { id: "USA-0008" } }).getField('layers').filter(function(v) {
return v('object').hasFields('fontFamily')
}).concatMap(function(v) {
return v('object')('fontFamily')
}).distinct()
@terrancesnyder
terrancesnyder / rethinkdb_merge_pushdown_crazy.js
Created April 7, 2016 23:52
rethinkdb_merge_pushdown_crazy.js
r.db('test')
.table('templates')
.filter({ network: { id: 'USA-0034' } })
.concatMap(function(d) {
return d('layers').do(function(l) {
return l.merge({ template: d('id') })
});
})
.filter({ image_var: 'product_shot_url' })
.map(function(d) {