Skip to content

Instantly share code, notes, and snippets.

View zubairov's full-sized avatar

Renat Zubairov zubairov

View GitHub Profile
@zubairov
zubairov / README.md
Last active February 7, 2018 22:14
Simples e.io component

HOWTO

mkdir fubar
cd fubar
npm init .
# Don't forget to specify the test command like 'exit 0'
npm install --save elasticio-sailor-nodejs
npm install --save fibonacci-fast
# Copy files above
{
"type": "object",
"properties": {
"customer_id": {
"type": "number",
"required": false,
"title": "Customer id"
},
"created_at": {
"type": "string",
// Please note only Node.js code is supported here
console.log('We have a message query=%j and body=%j', msg.query || {}, msg.body || {});
if (msg.query && msg.body) {
msg.body.__query = msg.query;
}
// Emit the data event
emitter.emit('data', msg);
// No need to emit end
console.log('Finished execution');
curl -X POST https://apixpc.magicsoftware.com/v2/flows \
-u renat+magicsoftware@elastic.io:4fc886b7-fef3-4c1e-a3c1-2f679e278583 \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d $'
{
"data": {
"attributes": {
"name": "Copy of Performance Test",
"cron": null,
"default_mapper_type": "jsonata",
@zubairov
zubairov / contact-meta.json
Last active December 28, 2017 09:27
Sample metadata from Salesforce API Version 39
{
"fullName": "Contact",
"actionOverrides": [
{
"actionName": "AddCampaign",
"type": "Default"
},
{
"actionName": "AddToCampaign",
"type": "Default"
package com.acme.comp.actions;
public class CreateCustomerAction extends Component {
@Override
public final void execute(ExecutionParameters parameters) {
logger.info("About to execute create customer action");
// This is an incoming message
final Message message = parameters.getMessage();
// This is outgoing result
@zubairov
zubairov / EDIHandler.java
Created March 6, 2011 09:13
SAX Handler that writes out EDI
package org.milyn.edisax;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
function* run() {
console.log('Incoming attachments=%j', Object.keys(msg.attachments || {}));
for(let name in msg.attachments) {
let attachment = msg.attachments[name];
console.log('Handling attachment with name=%s url=%s', name, attachment.url);
var result = yield request.get({uri : attachment.url});
console.log('Content of the attachment is %j', result.body);
};
return {};
}
@zubairov
zubairov / article.md
Last active August 4, 2016 14:07
Running a docker private registry on EC2

tl;dr This blog post describes the best way to host private Docker Registry instance on Amazon EC2 and Amazon S3. You can skip the lyrics and go to the 'Resources' section to get the ECS Task Definition JSON.

When working with microservices nowadays you can hardly avoid using Docker. After building your first Docker container your next step woudl be to share it with the world (or your colleauge). To achieve it you have three alternatives:

  1. Use a Docker Hub or any other SaaS registry.
  2. Deploy your own instance of open source Docker Registry project (now called 'Distribution').
  3. Buy an enterprise version of the Docker registry which is based on open source docker registry project with some addons from Docker Inc.

For a small project the Docker Hub 'way' is the best alternative, you can host one 'private' image for free, where commercial pricing plans will allow you to upload more. For a more serious projects we would like to re

var Q = require('q');
var elasticio = require('elasticio-node');
var messages = elasticio.messages;
var soap = require('soap');
exports.process = processTrigger;
function processTrigger(msg, cfg) {
var self = this;
var username = cfg.username;