Skip to content

Instantly share code, notes, and snippets.

View lamchakchan's full-sized avatar

Lam Chan lamchakchan

View GitHub Profile
@lamchakchan
lamchakchan / medium-bunnybus-publisher.js
Last active February 22, 2017 22:31
BunnyBus publisher
const BunnyBus = require('bunnybus');
const bunnyBus = new BunnyBus();
bunnyBus.publish({
event : 'message-created',
body : 'hello world'
});
@lamchakchan
lamchakchan / medium-bunnybus-subscriber.js
Last active February 22, 2017 22:31
BunnyBus subscriber example
const BunnyBus = require('bunnybus');
const bunnyBus = new BunnyBus();
const handlersForQueue1 = {
'message_created' : (message, ack) => {
//do some work!
ack();
},
// set up more route key and handlers
const someCallBackFunction = require('some-module');
const someCallBackAsync = function (data) {
return Promise((resolve, reject) => {
someCallBackAsync(data, (err, result) => {
if(err) {
reject(err);
}
else {
const Promise = require('bluebird');
const request = require('superagent');
const getXYZandABCResults = function() {
const self = this;
const task1 = request.get('http://www.xyz.com');
const task2 = request.get('http://www.abc.com');
host,path,protocol
qa-no-services.theknot.com,/local-partners/api/identity/identities/search,https
geo-api.xogrp.com,/geo/locations/market/%s,http
qa-no-services.theknot.com,/local-partners/tkpintegration/createtoken/%s,https
qa-no-services.theknot.com,/local-partners/api/identity/identities/search,https
qa-no-services.theknot.com,/local-partners/api/conversation/conversations/message,https
qa-no-services.theknot.com,/local-partners/api/conversation-theknot/conversations/message,https
qa-no-services.theknot.com,/local-partners/api/conversation-theknot/conversations/message,https
qa-no-services.theknot.com,/local-partners/api/identity/identities/search,https
qa-no-services.theknot.com,/local-partners/api/conversation/conversations/messages/,https
name,version
xo-ds-handler,4.3.0
xo-request,2.4.1
xo-rabbit,6.8.0
xo-logger,0.4.6
xo-error,1.0.4
name,version,environment
service-app-auth,1.4.1,qa
service-bi-api,0.0.1,qa
service-conversation-api,14.10.1,qa
service-conversation-bride-indexer,2.8.7,qa
service-conversation-indexer,5.6.1,qa
service-conversation-mail-api,4.0.2,qa
service-conversation-planner-api,17.12.1,qa
service-conversation-theknot-api,18.12.1,qa
service-conversation-vendor-indexer,2.8.7,qa
#!/bin/sh
export PATH=/usr/local/bin:$PATH
files=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$")
pass=true
if [ "$files" = "" ]; then
exit 0
fi
@lamchakchan
lamchakchan / gist:0e0fd87ce57b8ce5574c
Created April 15, 2015 16:59
Install Elasticsearch Curator and set crontab
#!/bin/sh
#install the curator cli
pip install elasticsearch-curator
#output the existing crontab
crontab -l > crontab.bak
echo "16 1 * * * /usr/local/bin/curator --host 127.0.0.1 delete indices --older-than 4 --time-unit days --prefix .marvel- --timestring '\%Y.\%m.\%d'" >> crontab.bak
crontab crontab.bak
rm crontab.bak
@lamchakchan
lamchakchan / gist:aac7089dfc3daab3ce59
Created April 14, 2015 17:17
Elasticsearch Rolling Restart
#!/bin/bash
#
# perform a rolling restart of all data/master nodes in a stable cluster
#
# args: [elasticsearch-host:port]
#
set -e
set -u