Skip to content

Instantly share code, notes, and snippets.

View miere's full-sized avatar
😁
Distributing data among friends

Miere Teixeira miere

😁
Distributing data among friends
View GitHub Profile
@miere
miere / EndOfRequestListener.java
Created May 30, 2018 17:56
Undertow NewRelic Tracing
import com.newrelic.api.agent.*;
import io.undertow.server.*;
import lombok.*;
@RequiredArgsConstructor
class EndOfRequestListener implements ExchangeCompletionListener {
final Token token;
@Override @Trace( async = true )
@miere
miere / MyTracer.java
Created May 29, 2018 01:33
Kikaha request tracer.
import java.io.IOException;
import javax.inject.Singleton;
import io.undertow.Undertow.Builder;
import io.undertow.server.*;
import kikaha.core.DeploymentContext;
import kikaha.core.modules.Module;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
/**
@miere
miere / ForwardProxyWithUndertow.java
Created January 9, 2018 15:18
A Forward Proxy implementation with Undertow.
public class ForwardProxyWithUndertow {
public static void main( String[] args ) {
final HttpHandler forwardProxyHandler = new ConnectHandler( ForwardProxyWithUndertow::handleNotFound );
Undertow.builder()
.addHttpListener(8080, "localhost")
.setHandler( forwardProxyHandler )
.build()
.start();
@miere
miere / KafkaKikahaApp.java
Created May 23, 2017 14:28
Using KafkaStream on your Java application - the Kikaha way. Based on samples found https://www.confluent.io/blog/introducing-kafka-streams-stream-processing-made-simple/
import static org.apache.kafka.streams.StreamsConfig.*;
import kikaha.core.cdi.Application;
import kikaha.config.Config;
import javax.inject.*;
/**
* Using KafkaStream on your Java application - the Kikaha way.
*/
@Singleton
public class KafkaKikahaApp implements Application {
@miere
miere / pom.xml
Last active May 17, 2017 14:10
Kikaha project that deploys on AWS CodeDeploy
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.skullabs.kikaha</groupId>
<artifactId>kikaha-project</artifactId>
<!-- PUT THE KIKAHA VERSION HERE -->
<version>2.1.0-alpha16</version>
</parent>
@miere
miere / GuideToDeployKikahaAppsAtAmazon.md
Last active June 15, 2017 01:28
Guide to deploy Kikaha apps at Amazon

Guide to deploy Kikaha apps at Amazon

The objective of this guide is show basic features kikaha offers out-of-box which may be useful to make deployment and monitoring easier on Amazon.

Requirements

This guide is focused on 2.1.x version of Kikaha which at the date of this wrinting is still under beta state. Its release date is planed to June, 2017. Also this guide assumes you are familiar with Amazon Web Services and how services are authenticated on AWS.

For more information about AWS, please consult this guide.

AWS Cloud Modules Overview

Out-of-box Kikaha provides some features which integrates with AWS services:

@miere
miere / README.md
Last active April 3, 2022 23:01
Elementary OS Loki - Customization

Elementary OS Loki

This guide will help you to have a better experience with ElementaryOS

Installing the 'add-apt-repository'

Elementary OS come out-of-box with a large set of applications available from the AppCenter. The ElementaryOS developers believe that this set of application will provide you a great user experience and you may not need any other third-party application installed on your OS. Thus, it does not have the 'add-apt-repository' installed on your system.

But, it is quite easy to install it on your EOS.

@miere
miere / README.md
Last active January 6, 2017 11:17
A simple mixin to solve the "parent.parent" hell with RiotJS

Contextual Mixin for Riot.js

Try to avoid the 'parent.parent... hell' with a simple mixin.

Usage

  1. Create an object with all data you want to be accessible through your child tags
  2. Decorate the outer most tag with the attribute 'context'
  3. Make all your tags to use the 'context' mixin
  4. Configure RiotJS to point the 'context' mixin to 'context_mixin

You can see it in action here.

ko.bindingHandlers.doubleClick= {
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var handler = valueAccessor(),
delay = 200,
clickTimeout = false
function handleDoubleClick(e) {
if(clickTimeout !== false) {
clickTimeout = false
@miere
miere / Threads.java
Created April 12, 2016 13:04
Convenient abstraction to deal with Threads and ExecutorServices.
package sizebay.publictools;
import lombok.RequiredArgsConstructor;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;