Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️
Studying IoT

Daniel Bevenius danbev

⌨️
Studying IoT
View GitHub Profile
@danbev
danbev / backing-store-test.md
Last active Oct 27, 2020
compile and run test-backing-store with gcc
View backing-store-test.md

compile script:

#!/bin/bash                                                                     
                                                                                
if [ "$1" != "" ]; then                                                         
  out_dir="$1"                                                                  
else                                                                            
  echo "Please specify a v8 build directory: $0 out/dir"                        
  exit 2                                                                        
fi                                                                              
@danbev
danbev / gist:3938238
Created Oct 23, 2012
RestEasy Programmatic Configuration
View gist:3938238

Programmatic endpoint configuration in RestEasy

This section will try to sort out the best way to implement programmatic endpoint configuration. The approach taken is to make as few changes as possible to RestEasy, which is means that when changes were required whole methods have been copied and those new methods changed were possible.

The following branch contains the code discussed in this document: programmatic-config

Lets starting with a very basic POJO like this:

public class Pojo
{
   public String doit()
@danbev
danbev / websocket-enhancement.md
Created Sep 2, 2012
Netty 4 WebSocket enhancement
View websocket-enhancement.md

Netty 4 WebSocket

Netty has had WebSocket support for quite a while now and it is easy to get up an running quickly with the existing examples. The example provided with Netty, consists of a handler which takes care of the HTTP Upgrade handshake, and also manages the WebSocket protocol. If you need to service http requests, for example serving static files, in addition to WebSocket calls then this approach works great.

But if all you want to do is create a custom application protocol on top of WebSocket and only service WebSocket requests, then the above solution is a fair amount of code that you'll have to maintain yourself. So, we set out to try to simplify this and this post describes what we came up with.

Below is an example of implementing a handler that will receive a [TextWebSocketFrame](https://github.com/netty/netty/blob/master/codec-http/src/main/java/io/nett

@danbev
danbev / gist:9800590
Last active Apr 30, 2017
Netty SockJS Refactoring
View gist:9800590

Netty SockJS Refactoring

Pull request #1615 is intended to add SockJS support to Netty. It does so by adding an API on top of Netty that end users have to implement. The interface that users had to implement looks like this:

/**
 * Represents the server side business application server in SockJS.
 */
public interface SockJsService {

    /**
     * The {@link SockJsConfig} for this service
@danbev
danbev / gist:9887071
Created Mar 31, 2014
SockJS curl commands
View gist:9887071

Open or poll a xhr polling session:

curl -v http://localhost:8081/echo/123/123/xhr

Send to a xhr polling session:

curl -i --header "Content-Type: application/javascript" -X POST -d '["data"]' http://localhost:8081/echo/123/123/xhr_send
View obj-path.patch
diff --git a/common.gypi b/common.gypi
index 147cc70..b84c54c 100644
--- a/common.gypi
+++ b/common.gypi
@@ -38,21 +38,31 @@
['OS == "win"', {
'os_posix': 0,
'v8_postmortem_support%': 'false',
+ 'OBJ_DIR': '<(PRODUCT_DIR)/obj',
+ 'OBJ_PATH': '<(PRODUCT_DIR)/obj/node',
@danbev
danbev / notes.md
Last active Feb 24, 2017
Kibana, ELB and OpenShift V3
View notes.md

The openshift/origin-haproxy-router is an HAProxy router that is used as an external to internal interface to OpenShift services. When you create a route you specify the hostname and service that the route is connecting.

[vagrant@local ~]$ oc get routes
NAME         HOST/PORT                   PATH      SERVICE              LABELS                                                       INSECURE POLICY   TLS TERMINATION
kibana       kibana.local.feedhenry.io             logging-kibana       component=support,logging-infra=support,provider=openshift                     passthrough
kibana-ops   kibana-ops.example.com                logging-kibana-ops   component=support,logging-infra=support,provider=openshift                     passthrough
View docker-registery-import.md

Say that you have followed the instructions in import.md and now want to update a deployment configuration or a running pod so that it uses that image.

First list the image of intrest:

$ docker images
REPOSITORY                                                    TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
danbev/es                                                     latest              59d06a20aff1        17 hours ago        415.9 MB

First tag the image. Add the namespace/project name after the registry ip:port. For example, I'm going to add the image to the mbaas-logging namespace/project

@danbev
danbev / gist:6974640
Created Oct 14, 2013
Non-relational data storage for AeroGear SimplePush Server
View gist:6974640

Storing data using CouchDB

A single channel is store in a single document that looks like this:

{
   "_id": "7b604e3e465f0baa7ccd59830a198f5a",
   "_rev": "2-f48636eeed43538d5423680ca0c5215e",
   "chid": "testingChannelId",
   "type": "channel",
   "token": "lmG5Rk0nYgFXOWJsuxzsmY8uKeButKQGa-HmrvtpJgGrzBCpUTAUe5TxyuH5TtlmQpJLmt1MA5sJLMFfAkE5EA",
   "uaid": "603cbe10-6e88-418e-92ee-18fed948bd24",
@danbev
danbev / gist:6606289
Last active Dec 23, 2015
SimplePush Server Performance
View gist:6606289

SimplePush Server performance

This doc intends to discuss preformance improvements for AeroGear SimplePush Server. Basically we are trying to figure out where we should focus to begin with.

This will start by picking an action that is performed by a client and profile for CPU perfomance, memory utilization and thread usage. After making improvements in that area, meansurement will be done again to see what the "hotspot" is after this.

This branch contains tests that can be run against an external server. Please see the "Integration Testing" section for details how to run the tests.

Environment

The SimplePush Server used in the Netty based implementation deployed to AS 7.1.1.Final.